posix: Add POSIX posix_spawn_file_actions_add{,f}chdir

Use proper symbols instead of alias to the *_np counterpart.

The declarations are also moved from __USE_XOPEN2K24XSI to
__USE_XOPEN2K24.  POSIX.1-2024 defines both functions as part of the
spawn option without XSI shading, so they must be visible under
_POSIX_C_SOURCE=202405L (and with the default feature set) as well.

Checked on x86_64-linux-gnu.
This commit is contained in:
Adhemerval Zanella committed 2026-09-28 12:57:36 -03:00
1 parent 24b18e1dfd
commit 371d58d11b
43 files changed
+120 -9

No files matched your search

+3 -1
View File
@@ -14,7 +14,9 @@ Major new features:
Deprecated and removed features, and other changes affecting compatibility:
[Add deprecations, removals and changes affecting compatibility here]
* The posix_spawn_file_actions_addchdir and posix_spawn_file_actions_addfchdir
functions, added in glibc 2.44 as header redirects to the _np variants, are
now exported from libc.so under the GLIBC_2.45 symbol version.
Changes to build and runtime requirements:
+4
View File
@@ -29,6 +29,10 @@ function int posix_spawnattr_setpgroup (posix_spawnattr_t*, pid_t)
function int posix_spawnattr_setschedparam (posix_spawnattr_t*, const struct sched_param*)
function int posix_spawnattr_setschedpolicy (posix_spawnattr_t*, int)
function int posix_spawnattr_setsigmask (posix_spawnattr_t*, const sigset_t*)
#if defined XOPEN2K24 || defined POSIX2024
function int posix_spawn_file_actions_addchdir (posix_spawn_file_actions_t*, const char *)
function int posix_spawn_file_actions_addfchdir (posix_spawn_file_actions_t*, int)
#endif
function int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t*, int)
function int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t*, int, int)
function int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t*, int, const char *, int, mode_t)
+1
View File
@@ -317,6 +317,7 @@ tests := \
tst-rxspencer-no-utf8 \
tst-sched_getaffinity \
tst-spawn-chdir \
tst-spawn-chdir-posix \
tst-spawn4 \
tst-spawn5 \
tst-spawn6 \
+4
View File
@@ -159,6 +159,10 @@ libc {
GLIBC_2.35 {
posix_spawn_file_actions_addtcsetpgrp_np;
}
GLIBC_2.45 {
posix_spawn_file_actions_addchdir;
posix_spawn_file_actions_addfchdir;
}
GLIBC_PRIVATE {
__libc_fork; __libc_pread; __libc_pwrite;
__nanosleep_nocancel; __pause_nocancel;
+18 -4
View File
@@ -200,17 +200,31 @@ extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
int __fd, int __newfd)
__THROW __nonnull ((1));
#ifdef __USE_MISC
#ifdef __USE_XOPEN2K24
/* Add an action changing the directory to PATH during spawn. This
affects the subsequent file actions. */
extern int posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *
__restrict __actions,
const char *__restrict __path)
extern int posix_spawn_file_actions_addchdir (posix_spawn_file_actions_t *
__restrict __actions,
const char *__restrict __path)
__THROW __nonnull ((1, 2));
/* Add an action changing the directory to FD during spawn. This
affects the subsequent file actions. FD is not duplicated and must
be open when the file action is executed. */
extern int posix_spawn_file_actions_addfchdir (posix_spawn_file_actions_t *,
int __fd)
__THROW __nonnull ((1));
#endif /* __USE_XOPEN2K24 */
#ifdef __USE_MISC
/* Same as posix_spawn_file_actions_addchdir. */
extern int posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *
__restrict __actions,
const char *__restrict __path)
__THROW __nonnull ((1, 2));
/* Same as posix_spawn_file_actions_addfchdir. */
extern int posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *,
int __fd)
__THROW __nonnull ((1));
+6 -2
View File
@@ -23,8 +23,8 @@
#include "spawn_int.h"
int
posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *file_actions,
const char *path)
__posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *file_actions,
const char *path)
{
struct __spawn_action *rec;
@@ -51,3 +51,7 @@ posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *file_actions,
return 0;
}
weak_alias (__posix_spawn_file_actions_addchdir_np,
posix_spawn_file_actions_addchdir_np)
weak_alias (__posix_spawn_file_actions_addchdir_np,
posix_spawn_file_actions_addchdir)
+6 -2
View File
@@ -23,8 +23,8 @@
#include "spawn_int.h"
int
posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *actions,
int fd)
__posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *actions,
int fd)
{
struct __spawn_action *rec;
@@ -44,3 +44,7 @@ posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *actions,
return 0;
}
weak_alias (__posix_spawn_file_actions_addfchdir_np,
posix_spawn_file_actions_addfchdir_np)
weak_alias (__posix_spawn_file_actions_addfchdir_np,
posix_spawn_file_actions_addfchdir)
+2
View File
@@ -0,0 +1,2 @@
#define USE_POSIX
#include "tst-spawn-chdir.c"
+8
View File
@@ -78,12 +78,20 @@ add_chdir (posix_spawn_file_actions_t *actions, const char *path,
{
TEST_COMPARE (posix_spawn_file_actions_addopen
(actions, tmpfd, path, O_DIRECTORY | O_RDONLY, 0), 0);
#ifdef USE_POSIX
TEST_COMPARE (posix_spawn_file_actions_addfchdir (actions, tmpfd), 0);
#else
TEST_COMPARE (posix_spawn_file_actions_addfchdir_np
(actions, tmpfd), 0);
#endif
TEST_COMPARE (posix_spawn_file_actions_addclose (actions, tmpfd), 0);
}
else
#ifdef USE_POSIX
TEST_COMPARE (posix_spawn_file_actions_addchdir (actions, path), 0);
#else
TEST_COMPARE (posix_spawn_file_actions_addchdir_np (actions, path), 0);
#endif
}
static int
+2
View File
@@ -2835,6 +2835,8 @@ GLIBC_2.44 timer_delete F
GLIBC_2.44 timer_getoverrun F
GLIBC_2.44 timer_gettime F
GLIBC_2.44 timer_settime F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
+2
View File
@@ -2511,6 +2511,8 @@ GLIBC_2.44 timer_delete F
GLIBC_2.44 timer_getoverrun F
GLIBC_2.44 timer_gettime F
GLIBC_2.44 timer_settime F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
HURD_CTHREADS_0.3 __mutex_init F
HURD_CTHREADS_0.3 __mutex_lock F
HURD_CTHREADS_0.3 __mutex_trylock F
@@ -2775,3 +2775,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -3122,6 +3122,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
+2
View File
@@ -2536,3 +2536,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2828,6 +2828,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2825,6 +2825,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2812,3 +2812,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2849,6 +2849,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -3032,6 +3032,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2287,3 +2287,5 @@ GLIBC_2.44 wprintf F
GLIBC_2.44 write F
GLIBC_2.44 writev F
GLIBC_2.44 wscanf F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2296,3 +2296,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2808,6 +2808,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2975,6 +2975,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2861,3 +2861,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2858,3 +2858,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2938,6 +2938,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2936,6 +2936,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2944,6 +2944,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2846,6 +2846,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2286,3 +2286,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -3165,6 +3165,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -3210,6 +3210,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2919,6 +2919,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2995,3 +2995,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2539,3 +2539,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2739,3 +2739,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
@@ -2956,6 +2956,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2855,6 +2855,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2852,6 +2852,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -3186,6 +3186,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2822,6 +2822,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2771,6 +2771,8 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2790,3 +2790,5 @@ GLIBC_2.43 memset_explicit F
GLIBC_2.43 mseal F
GLIBC_2.43 openat2 F
GLIBC_2.43 umaxabs F
GLIBC_2.45 posix_spawn_file_actions_addchdir F
GLIBC_2.45 posix_spawn_file_actions_addfchdir F