diff --git a/libc-test/build.rs b/libc-test/build.rs index edb1556c2d6d6..8984f45c5d84c 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3825,6 +3825,7 @@ fn test_linux(target: &str) { "linux/netfilter_ipv6.h", "linux/netfilter_ipv6/ip6_tables.h", "linux/netlink.h", + "linux/nsfs.h", "linux/openat2.h", // FIXME(linux): some items require Linux >= 5.6: "linux/ptp_clock.h", @@ -4118,6 +4119,9 @@ fn test_linux(target: &str) { // FIXME(linux): Requires >= 6.12 kernel headers. "dmabuf_cmsg" | "dmabuf_token" => true, + // FIXME(linux): Requires >= 6.12 kernel headers. + "mnt_ns_info" => true, + // FIXME(linux): Requires >= 6.4 kernel headers. "ptrace_sud_config" => true, @@ -4516,6 +4520,11 @@ fn test_linux(target: &str) { true } + // FIXME(linux): Requires >= 6.11 kernel headers. + "NS_GET_MNTNS_ID" | "NS_GET_PID_FROM_PIDNS" | "NS_GET_TGID_FROM_PIDNS" | "NS_GET_PID_IN_PIDNS" | "NS_GET_TGID_IN_PIDNS" => true, + // FIXME(linux): Requires >= 6.12 kernel headers. + "MNT_NS_INFO_SIZE_VER0" | "NS_MNT_GET_INFO" | "NS_MNT_GET_NEXT" | "NS_MNT_GET_PREV" => true, + // FIXME(linux): Requires >= 6.6 kernel headers. "SYS_fchmodat2" => true, @@ -4868,8 +4877,8 @@ fn test_linux_like_apis(target: &str) { "strerror_r" => false, _ => true, }) - .skip_const(|_| true) - .skip_struct(|_| true); + .skip_const(|_| true) + .skip_struct(|_| true); cfg.generate(src_hotfix_dir().join("lib.rs"), "linux_strerror_r.rs"); } @@ -4943,10 +4952,10 @@ fn test_linux_like_apis(target: &str) { .skip_const(|_| true) .skip_struct(|_| true) .skip_const(move |name| match name { - "IPV6_FLOWINFO" - | "IPV6_FLOWLABEL_MGR" - | "IPV6_FLOWINFO_SEND" - | "IPV6_FLOWINFO_FLOWLABEL" + "IPV6_FLOWINFO" + | "IPV6_FLOWLABEL_MGR" + | "IPV6_FLOWINFO_SEND" + | "IPV6_FLOWINFO_FLOWLABEL" | "IPV6_FLOWINFO_PRIORITY" => false, _ => true, }) diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 0df79b0dc0b30..7e53102451f7b 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1667,6 +1667,7 @@ MMAP_PAGE_ZERO MNT_DETACH MNT_EXPIRE MNT_FORCE +MNT_NS_INFO_SIZE_VER0 MODULE_INIT_IGNORE_MODVERSIONS MODULE_INIT_IGNORE_VERMAGIC MON_1 @@ -2022,6 +2023,18 @@ NLM_F_REQUEST NLM_F_ROOT NOEXPR NOSTR +NS_GET_MNTNS_ID +NS_GET_NSTYPE +NS_GET_OWNER_UID +NS_GET_PARENT +NS_GET_PID_FROM_PIDNS +NS_GET_PID_IN_PIDNS +NS_GET_TGID_FROM_PIDNS +NS_GET_TGID_IN_PIDNS +NS_GET_USERNS +NS_MNT_GET_INFO +NS_MNT_GET_NEXT +NS_MNT_GET_PREV NTF_PROXY NTF_ROUTER NTF_SELF diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 56cd1bed5afe6..bdadd56c50c72 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1376,6 +1376,13 @@ s! { pub userns_fd: crate::__u64, } + // linux/nsfs.h + pub struct mnt_ns_info { + pub size: crate::__u32, + pub nr_mounts: crate::__u32, + pub mnt_ns_id: crate::__u64, + } + // linux/pidfd.h pub struct pidfd_info { @@ -3172,6 +3179,27 @@ pub const MREMAP_MAYMOVE: c_int = 1; pub const MREMAP_FIXED: c_int = 2; pub const MREMAP_DONTUNMAP: c_int = 4; +// linux/nsfs.h +const NSIO: c_uint = 0xb7; + +pub const NS_GET_USERNS: c_uint = _IO(NSIO, 0x1); +pub const NS_GET_PARENT: c_uint = _IO(NSIO, 0x2); +pub const NS_GET_NSTYPE: c_uint = _IO(NSIO, 0x3); +pub const NS_GET_OWNER_UID: c_uint = _IO(NSIO, 0x4); + +pub const NS_GET_MNTNS_ID: c_uint = _IOR::<__u64>(NSIO, 0x5); + +pub const NS_GET_PID_FROM_PIDNS: c_uint = _IOR::(NSIO, 0x6); +pub const NS_GET_TGID_FROM_PIDNS: c_uint = _IOR::(NSIO, 0x7); +pub const NS_GET_PID_IN_PIDNS: c_uint = _IOR::(NSIO, 0x8); +pub const NS_GET_TGID_IN_PIDNS: c_uint = _IOR::(NSIO, 0x9); + +pub const MNT_NS_INFO_SIZE_VER0: c_uint = 16; + +pub const NS_MNT_GET_INFO: c_uint = _IOR::(NSIO, 10); +pub const NS_MNT_GET_NEXT: c_uint = _IOR::(NSIO, 11); +pub const NS_MNT_GET_PREV: c_uint = _IOR::(NSIO, 12); + // linux/pidfd.h pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint; pub const PIDFD_THREAD: c_uint = O_EXCL as c_uint;