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 @@ -2689,6 +2689,8 @@ fn test_linux(target: &str) {
2689
2689
"linux/netfilter_ipv6.h" ,
2690
2690
"linux/netfilter_ipv6/ip6_tables.h" ,
2691
2691
"linux/netlink.h" ,
2692
+ // FIXME: requires more recent kernel headers:
2693
+ // "linux/openat2.h",
2692
2694
"linux/quota.h" ,
2693
2695
"linux/random.h" ,
2694
2696
"linux/reboot.h" ,
@@ -2830,6 +2832,9 @@ fn test_linux(target: &str) {
2830
2832
// Requires glibc 2.33 or newer.
2831
2833
"mallinfo2" => true ,
2832
2834
2835
+ // Might differ between kernel versions
2836
+ "open_how" => true ,
2837
+
2833
2838
_ => false ,
2834
2839
}
2835
2840
} ) ;
@@ -2972,6 +2977,14 @@ fn test_linux(target: &str) {
2972
2977
| "CLOSE_RANGE_UNSHARE"
2973
2978
| "CLOSE_RANGE_CLOEXEC" => true ,
2974
2979
2980
+ // FIXME: requires more recent kernel headers:
2981
+ | "RESOLVE_BENEATH"
2982
+ | "RESOLVE_CACHED"
2983
+ | "RESOLVE_IN_ROOT"
2984
+ | "RESOLVE_NO_MAGICLINKS"
2985
+ | "RESOLVE_NO_SYMLINKS"
2986
+ | "RESOLVE_NO_XDEV" => true ,
2987
+
2975
2988
// FIXME: Not currently available in headers on ARM, MIPS and musl.
2976
2989
"NETLINK_GET_STRICT_CHK" if arm || mips || musl => true ,
2977
2990
Original file line number Diff line number Diff line change @@ -1753,6 +1753,12 @@ RENAME_NOREPLACE
1753
1753
RENAME_WHITEOUT
1754
1754
REP_CNT
1755
1755
REP_MAX
1756
+ RESOLVE_BENEATH
1757
+ RESOLVE_CACHED
1758
+ RESOLVE_IN_ROOT
1759
+ RESOLVE_NO_MAGICLINKS
1760
+ RESOLVE_NO_SYMLINKS
1761
+ RESOLVE_NO_XDEV
1756
1762
RLIMIT_AS
1757
1763
RLIMIT_CORE
1758
1764
RLIMIT_CPU
@@ -2850,6 +2856,7 @@ nlmsgerr
2850
2856
nlmsghdr
2851
2857
off64_t
2852
2858
open64
2859
+ open_how
2853
2860
open_memstream
2854
2861
openat
2855
2862
openat64
Original file line number Diff line number Diff line change @@ -1825,6 +1825,14 @@ pub const MFD_HUGETLB: ::c_uint = 0x0004;
1825
1825
pub const CLOSE_RANGE_UNSHARE : :: c_uint = 1 << 1 ;
1826
1826
pub const CLOSE_RANGE_CLOEXEC : :: c_uint = 1 << 2 ;
1827
1827
1828
+ // linux/openat2.h
1829
+ pub const RESOLVE_NO_XDEV : :: __u64 = 0x01 ;
1830
+ pub const RESOLVE_NO_MAGICLINKS : :: __u64 = 0x02 ;
1831
+ pub const RESOLVE_NO_SYMLINKS : :: __u64 = 0x04 ;
1832
+ pub const RESOLVE_BENEATH : :: __u64 = 0x08 ;
1833
+ pub const RESOLVE_IN_ROOT : :: __u64 = 0x10 ;
1834
+ pub const RESOLVE_CACHED : :: __u64 = 0x20 ;
1835
+
1828
1836
// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
1829
1837
// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
1830
1838
// so we can use that type here to avoid having to cast.
@@ -3945,3 +3953,10 @@ cfg_if! {
3945
3953
}
3946
3954
}
3947
3955
expand_align ! ( ) ;
3956
+
3957
+ cfg_if ! {
3958
+ if #[ cfg( libc_non_exhaustive) ] {
3959
+ mod non_exhaustive;
3960
+ pub use self :: non_exhaustive:: * ;
3961
+ }
3962
+ }
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