Skip to content

Commit 204104b

Browse files
devnexentgross35
authored andcommitted
adding OPEN_TREE_NAMESPACE and fsopen/fsconfig/fsmount/fspick constants for Linux (7.0)
#5072 [ref](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/mount.h?h=v7.0)
1 parent aab67be commit 204104b

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

libc-test/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,6 +4201,14 @@ fn test_linux(target: &str) {
42014201
cfg.skip_const(move |constant| {
42024202
let name = constant.ident();
42034203

4204+
// FIXME(linux): Requires newer kernel headers than CI has. These uapi/linux/mount.h
4205+
// constants (OPEN_TREE_NAMESPACE landed in v7.0, FSCONFIG_CMD_CREATE_EXCL in v6.6)
4206+
// aren't defined by the headers CI builds against on several targets (notably the
4207+
// tier2 cross sysroots), so skip on every libc until CI catches up.
4208+
if name == "OPEN_TREE_NAMESPACE" || name == "FSCONFIG_CMD_CREATE_EXCL" {
4209+
return true;
4210+
}
4211+
42044212
// L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
42054213
// somewhere in the core libraries. uClibc wants 16k, but that's not enough.
42064214
if l4re && name == "PTHREAD_STACK_MIN" {
@@ -4223,6 +4231,10 @@ fn test_linux(target: &str) {
42234231
|| name.starts_with("EPOLL")
42244232
|| name.starts_with("F_")
42254233
|| name.starts_with("FALLOC_FL_")
4234+
|| name.starts_with("FSCONFIG_")
4235+
|| name.starts_with("FSMOUNT_")
4236+
|| name.starts_with("FSOPEN_")
4237+
|| name.starts_with("FSPICK_")
42264238
|| name.starts_with("FUTEX2_")
42274239
|| name.starts_with("IFLA_")
42284240
|| name.starts_with("KEXEC_")
@@ -4564,6 +4576,7 @@ fn test_linux(target: &str) {
45644576

45654577
let c_enums = [
45664578
"can_state",
4579+
"fsconfig_command",
45674580
"membarrier_cmd",
45684581
"pid_type",
45694582
"proc_cn_event",

libc-test/semver/linux.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,21 @@ FIONCLEX
901901
FIONREAD
902902
FLUSHO
903903
FOPEN_MAX
904+
FSCONFIG_CMD_CREATE
905+
FSCONFIG_CMD_CREATE_EXCL
906+
FSCONFIG_CMD_RECONFIGURE
907+
FSCONFIG_SET_BINARY
908+
FSCONFIG_SET_FD
909+
FSCONFIG_SET_FLAG
910+
FSCONFIG_SET_PATH
911+
FSCONFIG_SET_PATH_EMPTY
912+
FSCONFIG_SET_STRING
913+
FSMOUNT_CLOEXEC
914+
FSOPEN_CLOEXEC
915+
FSPICK_CLOEXEC
916+
FSPICK_EMPTY_PATH
917+
FSPICK_NO_AUTOMOUNT
918+
FSPICK_SYMLINK_NOFOLLOW
904919
FS_IOC32_GETFLAGS
905920
FS_IOC32_GETVERSION
906921
FS_IOC32_SETFLAGS
@@ -2205,6 +2220,7 @@ OFILL
22052220
OLCUC
22062221
OPEN_TREE_CLOEXEC
22072222
OPEN_TREE_CLONE
2223+
OPEN_TREE_NAMESPACE
22082224
O_ASYNC
22092225
O_DIRECT
22102226
O_DSYNC
@@ -4109,6 +4125,7 @@ freeifaddrs
41094125
freelocale
41104126
fremovexattr
41114127
freopen64
4128+
fsconfig_command
41124129
fseeko64
41134130
fsetpos64
41144131
fsetxattr

src/unix/linux_like/linux/mod.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,8 +3106,32 @@ pub const IN_NONBLOCK: c_int = O_NONBLOCK;
31063106

31073107
// uapi/linux/mount.h
31083108
pub const OPEN_TREE_CLONE: c_uint = 0x01;
3109+
pub const OPEN_TREE_NAMESPACE: c_uint = 0x02;
31093110
pub const OPEN_TREE_CLOEXEC: c_uint = O_CLOEXEC as c_uint;
31103111

3112+
pub const FSOPEN_CLOEXEC: c_uint = 0x00000001;
3113+
3114+
pub const FSPICK_CLOEXEC: c_uint = 0x00000001;
3115+
pub const FSPICK_SYMLINK_NOFOLLOW: c_uint = 0x00000002;
3116+
pub const FSPICK_NO_AUTOMOUNT: c_uint = 0x00000004;
3117+
pub const FSPICK_EMPTY_PATH: c_uint = 0x00000008;
3118+
3119+
pub const FSMOUNT_CLOEXEC: c_uint = 0x00000001;
3120+
3121+
c_enum! {
3122+
pub enum fsconfig_command {
3123+
pub FSCONFIG_SET_FLAG,
3124+
pub FSCONFIG_SET_STRING,
3125+
pub FSCONFIG_SET_BINARY,
3126+
pub FSCONFIG_SET_PATH,
3127+
pub FSCONFIG_SET_PATH_EMPTY,
3128+
pub FSCONFIG_SET_FD,
3129+
pub FSCONFIG_CMD_CREATE,
3130+
pub FSCONFIG_CMD_RECONFIGURE,
3131+
pub FSCONFIG_CMD_CREATE_EXCL,
3132+
}
3133+
}
3134+
31113135
// uapi/linux/netfilter/nf_tables.h
31123136
pub const NFT_TABLE_MAXNAMELEN: c_int = 256;
31133137
pub const NFT_CHAIN_MAXNAMELEN: c_int = 256;

0 commit comments

Comments
 (0)