Skip to content

Commit 126f2c6

Browse files
committed
Update pidfd constants and types (Linux 6.9-6.15)
1 parent 72f9d58 commit 126f2c6

File tree

9 files changed

+99
-7
lines changed

9 files changed

+99
-7
lines changed

libc-test/build.rs

+29
Original file line numberDiff line numberDiff line change
@@ -4046,6 +4046,10 @@ fn test_linux(target: &str) {
40464046
// Might differ between kernel versions
40474047
"open_how" => true,
40484048

4049+
// Linux >= 6.13 (pidfd_info.exit_code: Linux >= 6.15)
4050+
// Might differ between kernel versions
4051+
"pidfd_info" => true,
4052+
40494053
"sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo"
40504054
| "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true,
40514055

@@ -4152,6 +4156,7 @@ fn test_linux(target: &str) {
41524156
|| name.starts_with("OPEN_TREE_")
41534157
|| name.starts_with("P_")
41544158
|| name.starts_with("PF_")
4159+
|| name.starts_with("PIDFD_")
41554160
|| name.starts_with("RLIMIT_")
41564161
|| name.starts_with("RTEXT_FILTER_")
41574162
|| name.starts_with("SOL_")
@@ -4355,6 +4360,30 @@ fn test_linux(target: &str) {
43554360

43564361
// headers conflicts with linux/pidfd.h
43574362
"PIDFD_NONBLOCK" => true,
4363+
// Linux >= 6.9
4364+
"PIDFD_THREAD"
4365+
| "PIDFD_SIGNAL_THREAD"
4366+
| "PIDFD_SIGNAL_THREAD_GROUP"
4367+
| "PIDFD_SIGNAL_PROCESS_GROUP" => true,
4368+
// Linux >= 6.11
4369+
"PIDFD_GET_CGROUP_NAMESPACE"
4370+
| "PIDFD_GET_IPC_NAMESPACE"
4371+
| "PIDFD_GET_MNT_NAMESPACE"
4372+
| "PIDFD_GET_NET_NAMESPACE"
4373+
| "PIDFD_GET_PID_NAMESPACE"
4374+
| "PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE"
4375+
| "PIDFD_GET_TIME_NAMESPACE"
4376+
| "PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE"
4377+
| "PIDFD_GET_USER_NAMESPACE"
4378+
| "PIDFD_GET_UTS_NAMESPACE" => true,
4379+
// Linux >= 6.13
4380+
"PIDFD_GET_INFO"
4381+
| "PIDFD_INFO_PID"
4382+
| "PIDFD_INFO_CREDS"
4383+
| "PIDFD_INFO_CGROUPID"
4384+
| "PIDFD_INFO_SIZE_VER0" => true,
4385+
// Linux >= 6.15
4386+
"PIDFD_INFO_EXIT" | "PIDFD_SELF" | "PIDFD_SELF_PROCESS" => true,
43584387

43594388
// is a private value for kernel usage normally
43604389
"FUSE_SUPER_MAGIC" => true,

libc-test/semver/linux-musl.txt

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ OLD_TIME
2828
PF_IB
2929
PF_MPLS
3030
PF_XDP
31-
PIDFD_NONBLOCK
3231
PR_SET_VMA
3332
PR_SET_VMA_ANON_NAME
3433
RUN_LVL

libc-test/semver/linux.txt

+22
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,27 @@ PF_WANPIPE
21712171
PF_WQ_WORKER
21722172
PF_X
21732173
PF_X25
2174+
PIDFD_GET_CGROUP_NAMESPACE
2175+
PIDFD_GET_INFO
2176+
PIDFD_GET_IPC_NAMESPACE
2177+
PIDFD_GET_MNT_NAMESPACE
2178+
PIDFD_GET_NET_NAMESPACE
2179+
PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE
2180+
PIDFD_GET_PID_NAMESPACE
2181+
PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE
2182+
PIDFD_GET_TIME_NAMESPACE
2183+
PIDFD_GET_USER_NAMESPACE
2184+
PIDFD_GET_UTS_NAMESPACE
2185+
PIDFD_INFO_CGROUPID
2186+
PIDFD_INFO_CREDS
2187+
PIDFD_INFO_EXIT
2188+
PIDFD_INFO_PID
2189+
PIDFD_INFO_SIZE_VER0
2190+
PIDFD_NONBLOCK
2191+
PIDFD_SIGNAL_PROCESS_GROUP
2192+
PIDFD_SIGNAL_THREAD
2193+
PIDFD_SIGNAL_THREAD_GROUP
2194+
PIDFD_THREAD
21742195
PIDTYPE_MAX
21752196
PIDTYPE_PGID
21762197
PIDTYPE_PID
@@ -4043,6 +4064,7 @@ pause
40434064
personality
40444065
pgn_t
40454066
pid_type
4067+
pidfd_info
40464068
pipe2
40474069
popen
40484070
posix_fadvise

src/unix/linux_like/linux/gnu/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,6 @@ pub const RTLD_DI_TLS_MODID: c_int = 9;
755755
pub const RTLD_DI_TLS_DATA: c_int = 10;
756756

757757
pub const SOCK_NONBLOCK: c_int = O_NONBLOCK;
758-
pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint;
759758

760759
pub const SOL_RXRPC: c_int = 272;
761760
pub const SOL_PPPOL2TP: c_int = 273;

src/unix/linux_like/linux/mod.rs

+48
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,25 @@ s! {
13761376
pub userns_fd: crate::__u64,
13771377
}
13781378

1379+
// linux/pidfd.h
1380+
1381+
pub struct pidfd_info {
1382+
mask: crate::__u64,
1383+
cgroupid: crate::__u64,
1384+
pid: crate::__u32,
1385+
tgid: crate::__u32,
1386+
ppid: crate::__u32,
1387+
ruid: crate::__u32,
1388+
rgid: crate::__u32,
1389+
euid: crate::__u32,
1390+
egid: crate::__u32,
1391+
suid: crate::__u32,
1392+
sgid: crate::__u32,
1393+
fsuid: crate::__u32,
1394+
fsgid: crate::__u32,
1395+
exit_code: crate::__s32,
1396+
}
1397+
13791398
// linux/uio.h
13801399

13811400
pub struct dmabuf_cmsg {
@@ -3153,6 +3172,35 @@ pub const MREMAP_MAYMOVE: c_int = 1;
31533172
pub const MREMAP_FIXED: c_int = 2;
31543173
pub const MREMAP_DONTUNMAP: c_int = 4;
31553174

3175+
// linux/pidfd.h
3176+
pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint;
3177+
pub const PIDFD_THREAD: c_uint = O_EXCL as c_uint;
3178+
3179+
pub const PIDFD_SIGNAL_THREAD: c_uint = 1 << 0;
3180+
pub const PIDFD_SIGNAL_THREAD_GROUP: c_uint = 1 << 1;
3181+
pub const PIDFD_SIGNAL_PROCESS_GROUP: c_uint = 1 << 2;
3182+
3183+
pub const PIDFD_INFO_PID: c_uint = 1 << 0;
3184+
pub const PIDFD_INFO_CREDS: c_uint = 1 << 1;
3185+
pub const PIDFD_INFO_CGROUPID: c_uint = 1 << 2;
3186+
pub const PIDFD_INFO_EXIT: c_uint = 1 << 3;
3187+
3188+
pub const PIDFD_INFO_SIZE_VER0: c_uint = 64;
3189+
3190+
const PIDFS_IOCTL_MAGIC: c_uint = 0xFF;
3191+
pub const PIDFD_GET_CGROUP_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 1);
3192+
pub const PIDFD_GET_IPC_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 2);
3193+
pub const PIDFD_GET_MNT_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 3);
3194+
pub const PIDFD_GET_NET_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 4);
3195+
pub const PIDFD_GET_PID_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 5);
3196+
pub const PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 6);
3197+
pub const PIDFD_GET_TIME_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 7);
3198+
pub const PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 8);
3199+
pub const PIDFD_GET_USER_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 9);
3200+
pub const PIDFD_GET_UTS_NAMESPACE: c_uint = _IO(PIDFS_IOCTL_MAGIC, 10);
3201+
pub const PIDFD_GET_INFO: c_uint = _IOWR::<pidfd_info>(PIDFS_IOCTL_MAGIC, 11);
3202+
3203+
// linux/prctl.h
31563204
pub const PR_SET_PDEATHSIG: c_int = 1;
31573205
pub const PR_GET_PDEATHSIG: c_int = 2;
31583206

src/unix/linux_like/linux/musl/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,6 @@ pub const EFD_NONBLOCK: c_int = crate::O_NONBLOCK;
789789

790790
pub const SFD_NONBLOCK: c_int = crate::O_NONBLOCK;
791791

792-
pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint;
793-
794792
pub const TCSANOW: c_int = 0;
795793
pub const TCSADRAIN: c_int = 1;
796794
pub const TCSAFLUSH: c_int = 2;

src/unix/linux_like/linux/uclibc/arm/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ pub const POLLWRBAND: c_short = 0x200;
475475
pub const POLLWRNORM: c_short = 0x100;
476476
pub const PTHREAD_STACK_MIN: size_t = 16384;
477477
pub const RTLD_GLOBAL: c_int = 0x00100;
478-
pub const PIDFD_NONBLOCK: c_int = 0x800;
479478

480479
// These are typed unsigned to match sigaction
481480
pub const SA_NOCLDSTOP: c_ulong = 0x1;

src/unix/linux_like/linux/uclibc/mips/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub const O_LARGEFILE: c_int = 0x2000;
5757
pub const O_NDELAY: c_int = 0x80;
5858

5959
pub const SOCK_NONBLOCK: c_int = 128;
60-
pub const PIDFD_NONBLOCK: c_int = 128;
6160

6261
pub const EDEADLK: c_int = 45;
6362
pub const ENAMETOOLONG: c_int = 78;

src/unix/linux_like/linux/uclibc/x86_64/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
330330
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
331331
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
332332
pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
333-
pub const PIDFD_NONBLOCK: c_int = 0o4000;
334333

335334
cfg_if! {
336335
if #[cfg(target_os = "l4re")] {

0 commit comments

Comments
 (0)