diff options
author | Josh Triplett <josh@joshtriplett.org> | 2020-08-09 17:01:21 -0700 |
---|---|---|
committer | Josh Triplett <josh@joshtriplett.org> | 2020-08-18 14:11:08 -0700 |
commit | e709b3f78a2ae3cb4cab1222c1848797ebbe4735 (patch) | |
tree | d59f386ac0faff47ee606aae761482bf622c78bf | |
parent | ab3c229140cc6a609c52fd732ea76bf69f9a5855 (diff) | |
download | rust-libc-e709b3f78a2ae3cb4cab1222c1848797ebbe4735.tar.gz |
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.
-rw-r--r-- | libc-test/build.rs | 9 | ||||
-rw-r--r-- | src/unix/linux_like/mod.rs | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 753987a59b..637c46b2d3 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1486,6 +1486,7 @@ fn test_android(target: &str) { "linux/seccomp.h", "linux/sched.h", "linux/sockios.h", + "linux/wait.h", } @@ -1556,6 +1557,9 @@ fn test_android(target: &str) { // FIXME: deprecated - removed in glibc 2.26 "SIGUNUSED" => true, + // Needs a newer Android SDK for the definition + "P_PIDFD" => true, + _ => false, } }); @@ -2442,6 +2446,7 @@ fn test_linux(target: &str) { "linux/seccomp.h", "linux/sockios.h", "linux/vm_sockets.h", + "linux/wait.h", "sys/auxv.h", "sys/fanotify.h", } @@ -2626,6 +2631,10 @@ fn test_linux(target: &str) { // Require Linux kernel 5.6: "VMADDR_CID_LOCAL" => true, + // Defined in kernel headers but musl removes it; need musl 1.2 for definition in musl + // headers. + "P_PIDFD" => true, + _ => false, } }); diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index c5394f69b8..a5005ead08 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1034,6 +1034,11 @@ pub const SIGEV_THREAD: ::c_int = 2; pub const P_ALL: idtype_t = 0; pub const P_PID: idtype_t = 1; pub const P_PGID: idtype_t = 2; +cfg_if! { + if #[cfg(not(target_os = "emscripten"))] { + pub const P_PIDFD: idtype_t = 3; + } +} pub const UTIME_OMIT: c_long = 1073741822; pub const UTIME_NOW: c_long = 1073741823; |