Skip to content

Commit e709b3f

Browse files
committed
Define P_PIDFD, used with waitid
Linux defines a waitid type `P_PIDFD`, for use with process file descriptors (`pidfd`). Add that constant. In libc-test, add linux/wait.h to the Linux-specific and Android-specific headers, to get the definition. Exclude it on Android and musl for now, though, as the versions in CI don't have it yet.
1 parent ab3c229 commit e709b3f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libc-test/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ fn test_android(target: &str) {
14861486
"linux/seccomp.h",
14871487
"linux/sched.h",
14881488
"linux/sockios.h",
1489+
"linux/wait.h",
14891490

14901491
}
14911492

@@ -1556,6 +1557,9 @@ fn test_android(target: &str) {
15561557
// FIXME: deprecated - removed in glibc 2.26
15571558
"SIGUNUSED" => true,
15581559

1560+
// Needs a newer Android SDK for the definition
1561+
"P_PIDFD" => true,
1562+
15591563
_ => false,
15601564
}
15611565
});
@@ -2442,6 +2446,7 @@ fn test_linux(target: &str) {
24422446
"linux/seccomp.h",
24432447
"linux/sockios.h",
24442448
"linux/vm_sockets.h",
2449+
"linux/wait.h",
24452450
"sys/auxv.h",
24462451
"sys/fanotify.h",
24472452
}
@@ -2626,6 +2631,10 @@ fn test_linux(target: &str) {
26262631
// Require Linux kernel 5.6:
26272632
"VMADDR_CID_LOCAL" => true,
26282633

2634+
// Defined in kernel headers but musl removes it; need musl 1.2 for definition in musl
2635+
// headers.
2636+
"P_PIDFD" => true,
2637+
26292638
_ => false,
26302639
}
26312640
});

src/unix/linux_like/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,11 @@ pub const SIGEV_THREAD: ::c_int = 2;
10341034
pub const P_ALL: idtype_t = 0;
10351035
pub const P_PID: idtype_t = 1;
10361036
pub const P_PGID: idtype_t = 2;
1037+
cfg_if! {
1038+
if #[cfg(not(target_os = "emscripten"))] {
1039+
pub const P_PIDFD: idtype_t = 3;
1040+
}
1041+
}
10371042

10381043
pub const UTIME_OMIT: c_long = 1073741822;
10391044
pub const UTIME_NOW: c_long = 1073741823;

0 commit comments

Comments
 (0)