Skip to content

Commit 5e98ea3

Browse files
committed
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.
2 parents 7489657 + fb7d1c5 commit 5e98ea3

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

libc-test/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,10 @@ fn test_linux(target: &str) {
37343734
// FIXME: the glibc version used by the Sparc64 build jobs
37353735
// which use Debian 10.0 is too old.
37363736
"statx" if sparc64 => true,
3737+
// Needs glibc 2.34 or later.
3738+
"posix_spawn_file_actions_addclosefrom_np" if gnu && sparc64 => true,
3739+
// Needs glibc 2.35 or later.
3740+
"posix_spawn_file_actions_addtcsetpgrp_np" if gnu && sparc64 => true,
37373741

37383742
// FIXME: Deprecated since glibc 2.30. Remove fn once upstream does.
37393743
"sysctl" if gnu => true,

libc-test/semver/linux-gnu.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,10 @@ ntp_adjtime
627627
ntp_gettime
628628
ntptimeval
629629
open_wmemstream
630+
posix_spawn_file_actions_addchdir_np
631+
posix_spawn_file_actions_addfchdir_np
632+
posix_spawn_file_actions_addclosefrom_np
633+
posix_spawn_file_actions_addtcsetpgrp_np
630634
preadv2
631635
preadv64
632636
prlimit

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,30 @@ extern "C" {
13791379
pub fn gnu_get_libc_version() -> *const ::c_char;
13801380
}
13811381

1382+
// posix/spawn.h
1383+
extern "C" {
1384+
// Added in `glibc` 2.29
1385+
pub fn posix_spawn_file_actions_addchdir_np(
1386+
actions: *mut ::posix_spawn_file_actions_t,
1387+
path: *const ::c_char,
1388+
) -> ::c_int;
1389+
// Added in `glibc` 2.29
1390+
pub fn posix_spawn_file_actions_addfchdir_np(
1391+
actions: *mut ::posix_spawn_file_actions_t,
1392+
fd: ::c_int,
1393+
) -> ::c_int;
1394+
// Added in `glibc` 2.34
1395+
pub fn posix_spawn_file_actions_addclosefrom_np(
1396+
actions: *mut ::posix_spawn_file_actions_t,
1397+
from: ::c_int,
1398+
) -> ::c_int;
1399+
// Added in `glibc` 2.35
1400+
pub fn posix_spawn_file_actions_addtcsetpgrp_np(
1401+
actions: *mut ::posix_spawn_file_actions_t,
1402+
tcfd: ::c_int,
1403+
) -> ::c_int;
1404+
}
1405+
13821406
cfg_if! {
13831407
if #[cfg(any(target_arch = "x86",
13841408
target_arch = "arm",

0 commit comments

Comments
 (0)