From f105c14266609e62c68b9e67e19044c555f11933 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 17 Oct 2023 18:54:56 +0100 Subject: [PATCH] adding MOVE_MOUNT* constants for linux to use with SYS_move_mount syscall. close #3387 --- libc-test/build.rs | 3 +++ libc-test/semver/linux-gnu.txt | 9 +++++++++ src/unix/linux_like/linux/gnu/mod.rs | 13 ++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index ffb972cb4145e..2f9d894b19318 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3862,6 +3862,9 @@ fn test_linux(target: &str) { // FIXME: Requires more recent kernel headers "HWTSTAMP_TX_ONESTEP_P2P" if musl => true, // linux v5.6+ + // kernel 6.5 minimum + "MOVE_MOUNT_BENEATH" => true, + _ => false, } }); diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index c37333b964046..04b07ec7f3983 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -140,6 +140,15 @@ MOD_OFFSET MOD_STATUS MOD_TAI MOD_TIMECONST +MOVE_MOUNT__MASK +MOVE_MOUNT_BENEATH +MOVE_MOUNT_F_AUTOMOUNTS +MOVE_MOUNT_F_EMPTY_PATH +MOVE_MOUNT_F_SYMLINKS +MOVE_MOUNT_SET_GROUP +MOVE_MOUNT_T_AUTOMOUNTS +MOVE_MOUNT_T_EMPTY_PATH +MOVE_MOUNT_T_SYMLINKS MPOL_BIND MPOL_DEFAULT MPOL_F_NUMA_BALANCING diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 175a49cd6696c..d81c835744276 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1029,7 +1029,18 @@ pub const STATX_ATTR_DAX: ::c_int = 0x00200000; pub const SOMAXCONN: ::c_int = 4096; -//sys/timex.h +// linux/mount.h +pub const MOVE_MOUNT_F_SYMLINKS: ::c_uint = 0x00000001; +pub const MOVE_MOUNT_F_AUTOMOUNTS: ::c_uint = 0x00000002; +pub const MOVE_MOUNT_F_EMPTY_PATH: ::c_uint = 0x00000004; +pub const MOVE_MOUNT_T_SYMLINKS: ::c_uint = 0x00000010; +pub const MOVE_MOUNT_T_AUTOMOUNTS: ::c_uint = 0x00000020; +pub const MOVE_MOUNT_T_EMPTY_PATH: ::c_uint = 0x00000040; +pub const MOVE_MOUNT_SET_GROUP: ::c_uint = 0x00000100; +pub const MOVE_MOUNT_BENEATH: ::c_uint = 0x00000200; +pub const MOVE_MOUNT__MASK: ::c_uint = 0x00000377; + +// sys/timex.h pub const ADJ_OFFSET: ::c_uint = 0x0001; pub const ADJ_FREQUENCY: ::c_uint = 0x0002; pub const ADJ_MAXERROR: ::c_uint = 0x0004;