From 4310e8e1c84144dda1b8e4fcdf2a555c513b70af Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 29 Jan 2026 15:00:12 -0500 Subject: [PATCH] posix_spawn: Expose file_actions_add[f]chdir. The non-"_np" versions were exported, but not declared in the header. Do that, and also make the "_np" versions the alias, as these are specified in POSIX-2024. --- headers/posix/spawn.h | 4 ++++ src/system/libroot/posix/spawn.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/headers/posix/spawn.h b/headers/posix/spawn.h index d88286d524..e47edf6b5f 100644 --- a/headers/posix/spawn.h +++ b/headers/posix/spawn.h @@ -55,6 +55,10 @@ extern int posix_spawn_file_actions_addclose( posix_spawn_file_actions_t *file_actions, int fildes); extern int posix_spawn_file_actions_adddup2( posix_spawn_file_actions_t *file_actions, int fildes, int newfildes); +extern int posix_spawn_file_actions_addchdir( + posix_spawn_file_actions_t *file_actions, const char *path); +extern int posix_spawn_file_actions_addfchdir( + posix_spawn_file_actions_t *file_actions, int fildes); /* spawn attribute functions */ extern int posix_spawnattr_destroy(posix_spawnattr_t *attr); diff --git a/src/system/libroot/posix/spawn.cpp b/src/system/libroot/posix/spawn.cpp index 3f362c89ff..111c089b46 100644 --- a/src/system/libroot/posix/spawn.cpp +++ b/src/system/libroot/posix/spawn.cpp @@ -195,7 +195,7 @@ posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *_actions, extern "C" int -posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *_actions, +posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *_actions, const char *path) { struct _posix_spawn_file_actions* actions = _actions != NULL ? *_actions : NULL; @@ -222,7 +222,7 @@ posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *_actions, extern "C" int -posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *_actions, +posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *_actions, int fildes) { struct _posix_spawn_file_actions* actions = _actions != NULL ? *_actions : NULL; @@ -623,5 +623,5 @@ posix_spawnp(pid_t *pid, const char *file, } -B_DEFINE_WEAK_ALIAS(posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addchdir); -B_DEFINE_WEAK_ALIAS(posix_spawn_file_actions_addfchdir_np, posix_spawn_file_actions_addfchdir); +B_DEFINE_WEAK_ALIAS(posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addchdir_np); +B_DEFINE_WEAK_ALIAS(posix_spawn_file_actions_addfchdir, posix_spawn_file_actions_addfchdir_np);