File tree 5 files changed +49
-0
lines changed
src/unix/linux_like/linux
5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ fn main() {
72
72
println ! ( "cargo:rustc-cfg=libc_cfg_target_vendor" ) ;
73
73
}
74
74
75
+ // Rust >= 1.40 supports #[non_exhaustive].
76
+ if rustc_minor_ver >= 40 || rustc_dep_of_std {
77
+ println ! ( "cargo:rustc-cfg=libc_non_exhaustive" ) ;
78
+ }
79
+
75
80
if rustc_minor_ver >= 51 || rustc_dep_of_std {
76
81
println ! ( "cargo:rustc-cfg=libc_ptr_addr_of" ) ;
77
82
}
Original file line number Diff line number Diff line change @@ -2653,6 +2653,8 @@ fn test_linux(target: &str) {
2653
2653
"linux/netfilter_ipv6.h" ,
2654
2654
"linux/netfilter_ipv6/ip6_tables.h" ,
2655
2655
"linux/netlink.h" ,
2656
+ // FIXME: requires more recent kernel headers:
2657
+ // "linux/openat2.h",
2656
2658
"linux/quota.h" ,
2657
2659
"linux/random.h" ,
2658
2660
"linux/reboot.h" ,
@@ -2794,6 +2796,9 @@ fn test_linux(target: &str) {
2794
2796
// Requires glibc 2.33 or newer.
2795
2797
"mallinfo2" => true ,
2796
2798
2799
+ // Might differ between kernel versions
2800
+ "open_how" => true ,
2801
+
2797
2802
_ => false ,
2798
2803
}
2799
2804
} ) ;
@@ -2932,6 +2937,14 @@ fn test_linux(target: &str) {
2932
2937
| "CLOSE_RANGE_UNSHARE"
2933
2938
| "CLOSE_RANGE_CLOEXEC" => true ,
2934
2939
2940
+ // FIXME: requires more recent kernel headers:
2941
+ | "RESOLVE_BENEATH"
2942
+ | "RESOLVE_CACHED"
2943
+ | "RESOLVE_IN_ROOT"
2944
+ | "RESOLVE_NO_MAGICLINKS"
2945
+ | "RESOLVE_NO_SYMLINKS"
2946
+ | "RESOLVE_NO_XDEV" => true ,
2947
+
2935
2948
// FIXME: Not currently available in headers on ARM, MIPS and musl.
2936
2949
"NETLINK_GET_STRICT_CHK" if arm || mips || musl => true ,
2937
2950
Original file line number Diff line number Diff line change @@ -1752,6 +1752,12 @@ RENAME_NOREPLACE
1752
1752
RENAME_WHITEOUT
1753
1753
REP_CNT
1754
1754
REP_MAX
1755
+ RESOLVE_BENEATH
1756
+ RESOLVE_CACHED
1757
+ RESOLVE_IN_ROOT
1758
+ RESOLVE_NO_MAGICLINKS
1759
+ RESOLVE_NO_SYMLINKS
1760
+ RESOLVE_NO_XDEV
1755
1761
RLIMIT_AS
1756
1762
RLIMIT_CORE
1757
1763
RLIMIT_CPU
@@ -2849,6 +2855,7 @@ nlmsgerr
2849
2855
nlmsghdr
2850
2856
off64_t
2851
2857
open64
2858
+ open_how
2852
2859
open_memstream
2853
2860
openat
2854
2861
openat64
Original file line number Diff line number Diff line change @@ -1824,6 +1824,14 @@ pub const MFD_HUGETLB: ::c_uint = 0x0004;
1824
1824
pub const CLOSE_RANGE_UNSHARE : :: c_uint = 1 << 1 ;
1825
1825
pub const CLOSE_RANGE_CLOEXEC : :: c_uint = 1 << 2 ;
1826
1826
1827
+ // linux/openat2.h
1828
+ pub const RESOLVE_NO_XDEV : :: __u64 = 0x01 ;
1829
+ pub const RESOLVE_NO_MAGICLINKS : :: __u64 = 0x02 ;
1830
+ pub const RESOLVE_NO_SYMLINKS : :: __u64 = 0x04 ;
1831
+ pub const RESOLVE_BENEATH : :: __u64 = 0x08 ;
1832
+ pub const RESOLVE_IN_ROOT : :: __u64 = 0x10 ;
1833
+ pub const RESOLVE_CACHED : :: __u64 = 0x20 ;
1834
+
1827
1835
// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
1828
1836
// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
1829
1837
// so we can use that type here to avoid having to cast.
@@ -3942,3 +3950,10 @@ cfg_if! {
3942
3950
}
3943
3951
}
3944
3952
expand_align ! ( ) ;
3953
+
3954
+ cfg_if ! {
3955
+ if #[ cfg( libc_non_exhaustive) ] {
3956
+ mod non_exhaustive;
3957
+ pub use self :: non_exhaustive:: * ;
3958
+ }
3959
+ }
Original file line number Diff line number Diff line change
1
+ s ! {
2
+ // linux/openat2.h
3
+ #[ non_exhaustive]
4
+ pub struct open_how {
5
+ pub flags: :: __u64,
6
+ pub mode: :: __u64,
7
+ pub resolve: :: __u64,
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments