File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed
src/unix/linux_like/linux Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ fn main() {
7272 println ! ( "cargo:rustc-cfg=libc_cfg_target_vendor" ) ;
7373 }
7474
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+
7580 if rustc_minor_ver >= 51 || rustc_dep_of_std {
7681 println ! ( "cargo:rustc-cfg=libc_ptr_addr_of" ) ;
7782 }
Original file line number Diff line number Diff line change @@ -2689,6 +2689,8 @@ fn test_linux(target: &str) {
26892689 "linux/netfilter_ipv6.h" ,
26902690 "linux/netfilter_ipv6/ip6_tables.h" ,
26912691 "linux/netlink.h" ,
2692+ // FIXME: requires more recent kernel headers:
2693+ // "linux/openat2.h",
26922694 "linux/quota.h" ,
26932695 "linux/random.h" ,
26942696 "linux/reboot.h" ,
@@ -2830,6 +2832,9 @@ fn test_linux(target: &str) {
28302832 // Requires glibc 2.33 or newer.
28312833 "mallinfo2" => true ,
28322834
2835+ // Might differ between kernel versions
2836+ "open_how" => true ,
2837+
28332838 _ => false ,
28342839 }
28352840 } ) ;
@@ -2972,6 +2977,14 @@ fn test_linux(target: &str) {
29722977 | "CLOSE_RANGE_UNSHARE"
29732978 | "CLOSE_RANGE_CLOEXEC" => true ,
29742979
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+
29752988 // FIXME: Not currently available in headers on ARM, MIPS and musl.
29762989 "NETLINK_GET_STRICT_CHK" if arm || mips || musl => true ,
29772990
Original file line number Diff line number Diff line change @@ -1753,6 +1753,12 @@ RENAME_NOREPLACE
17531753RENAME_WHITEOUT
17541754REP_CNT
17551755REP_MAX
1756+ RESOLVE_BENEATH
1757+ RESOLVE_CACHED
1758+ RESOLVE_IN_ROOT
1759+ RESOLVE_NO_MAGICLINKS
1760+ RESOLVE_NO_SYMLINKS
1761+ RESOLVE_NO_XDEV
17561762RLIMIT_AS
17571763RLIMIT_CORE
17581764RLIMIT_CPU
@@ -2850,6 +2856,7 @@ nlmsgerr
28502856nlmsghdr
28512857off64_t
28522858open64
2859+ open_how
28532860open_memstream
28542861openat
28552862openat64
Original file line number Diff line number Diff line change @@ -1825,6 +1825,14 @@ pub const MFD_HUGETLB: ::c_uint = 0x0004;
18251825pub const CLOSE_RANGE_UNSHARE : :: c_uint = 1 << 1 ;
18261826pub const CLOSE_RANGE_CLOEXEC : :: c_uint = 1 << 2 ;
18271827
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+
18281836// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
18291837// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
18301838// so we can use that type here to avoid having to cast.
@@ -3945,3 +3953,10 @@ cfg_if! {
39453953 }
39463954}
39473955expand_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