diff options
author | bors <bors@rust-lang.org> | 2023-02-22 08:31:09 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2023-02-22 08:31:09 +0000 |
commit | 5e98ea33195cc867faad2355f16c9bef1dad6a47 (patch) | |
tree | 7f9eca5bc51c9f89b159b995507bb34ce20ba3b9 | |
parent | 7489657b1fb3ed5b80b60f383ab8025f4797e365 (diff) | |
parent | fb7d1c5d677a372c392feda9ee50f77cad6cd20c (diff) | |
download | rust-libc-5e98ea33195cc867faad2355f16c9bef1dad6a47.tar.gz |
Auto merge of #3119 - kosayoda:posix_spawn_gnu, r=JohnTitor
Add glibc extensions for posix_spawn*.
This PR adds support for posix spawn extensions implemented by glibc: https://elixir.bootlin.com/glibc/glibc-2.37.9000/source/posix/spawn.h#L201.
-rw-r--r-- | libc-test/build.rs | 4 | ||||
-rw-r--r-- | libc-test/semver/linux-gnu.txt | 4 | ||||
-rw-r--r-- | src/unix/linux_like/linux/gnu/mod.rs | 24 |
3 files changed, 32 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 6cb00172d4..98c802e338 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3734,6 +3734,10 @@ fn test_linux(target: &str) { // FIXME: the glibc version used by the Sparc64 build jobs // which use Debian 10.0 is too old. "statx" if sparc64 => true, + // Needs glibc 2.34 or later. + "posix_spawn_file_actions_addclosefrom_np" if gnu && sparc64 => true, + // Needs glibc 2.35 or later. + "posix_spawn_file_actions_addtcsetpgrp_np" if gnu && sparc64 => true, // FIXME: Deprecated since glibc 2.30. Remove fn once upstream does. "sysctl" if gnu => true, diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index aaeb408150..736a8d2a56 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -627,6 +627,10 @@ ntp_adjtime ntp_gettime ntptimeval open_wmemstream +posix_spawn_file_actions_addchdir_np +posix_spawn_file_actions_addfchdir_np +posix_spawn_file_actions_addclosefrom_np +posix_spawn_file_actions_addtcsetpgrp_np preadv2 preadv64 prlimit diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 21396751d0..2d84ec662d 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1379,6 +1379,30 @@ extern "C" { pub fn gnu_get_libc_version() -> *const ::c_char; } +// posix/spawn.h +extern "C" { + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + path: *const ::c_char, + ) -> ::c_int; + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addfchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.34 + pub fn posix_spawn_file_actions_addclosefrom_np( + actions: *mut ::posix_spawn_file_actions_t, + from: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.35 + pub fn posix_spawn_file_actions_addtcsetpgrp_np( + actions: *mut ::posix_spawn_file_actions_t, + tcfd: ::c_int, + ) -> ::c_int; +} + cfg_if! { if #[cfg(any(target_arch = "x86", target_arch = "arm", |