git: 43347b26fb46 - stable/15 - posix_spawn: actions chdir and fchdir are now required by POSIX
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Apr 2026 08:25:49 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=43347b26fb461891fb139e24a9dd9f335465168b
commit 43347b26fb461891fb139e24a9dd9f335465168b
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-04-02 07:57:58 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-04-08 18:22:39 +0000
posix_spawn: actions chdir and fchdir are now required by POSIX
(cherry picked from commit 7caa71145c5eea5925c295e0cdd95b517005acf9)
---
ObsoleteFiles.inc | 4 ++++
include/spawn.h | 4 ++++
lib/libc/gen/Makefile.inc | 4 ++--
lib/libc/gen/Symbol.map | 2 ++
lib/libc/gen/posix_spawn.3 | 4 ++--
lib/libc/gen/posix_spawn.c | 5 +++++
lib/libc/gen/posix_spawn_file_actions_addopen.3 | 29 +++++++++++++++----------
7 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 4a92f2778d8c..86358dabf407 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,10 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20260402: posix_spawn_file_actions_addchdir lost _np suffix
+OLD_FILES+=usr/share/man/man3/posix_spawn_file_actions_addchdir_np.3.gz
+OLD_FILES+=usr/share/man/man3/posix_spawn_file_actions_addfchdir_np.3.gz
+
# 20260114: remove ncurses html documentation
OLD_FILES+=usr/share/doc/ncurses/hackguide.html
OLD_FILES+=usr/share/doc/ncurses/ncurses-intro.html
diff --git a/include/spawn.h b/include/spawn.h
index 636b20755238..e0b11d78d595 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -85,6 +85,10 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * __restrict,
int, const char * __restrict, int, mode_t);
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *
+ __restrict, const char * __restrict);
+int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *,
+ int);
#if __BSD_VISIBLE
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 28e55f58ccf3..c36c4e10f2dc 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -468,8 +468,8 @@ MLINKS+=posix_spawn.3 posix_spawnp.3 \
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addclose.3 \
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addclosefrom_np.3 \
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_adddup2.3 \
- posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addchdir_np.3 \
- posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addfchdir_np.3 \
+ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addchdir.3 \
+ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addfchdir.3 \
posix_spawn_file_actions_init.3 posix_spawn_file_actions_destroy.3 \
posix_spawnattr_getflags.3 posix_spawnattr_setflags.3 \
posix_spawnattr_getexecfd_np.3 posix_spawnattr_setexecfd_np.3 \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index ddbd0522e13f..60f34b3a1923 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -475,6 +475,8 @@ FBSD_1.8 {
};
FBSD_1.9 {
+ posix_spawn_file_actions_addchdir;
+ posix_spawn_file_actions_addfchdir;
posix_spawnattr_getexecfd_np;
posix_spawnattr_getprocdescp_np;
posix_spawnattr_setexecfd_np;
diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3
index f9dc95330a8c..ad66d1a426c4 100644
--- a/lib/libc/gen/posix_spawn.3
+++ b/lib/libc/gen/posix_spawn.3
@@ -446,11 +446,11 @@ action.
.Xr sched_setscheduler 2 ,
.Xr setpgid 2 ,
.Xr vfork 2 ,
-.Xr posix_spawn_file_actions_addchdir_np 3 ,
+.Xr posix_spawn_file_actions_addchdir 3 ,
.Xr posix_spawn_file_actions_addclose 3 ,
.Xr posix_spawn_file_actions_addclosefrom_np 3 ,
.Xr posix_spawn_file_actions_adddup2 3 ,
-.Xr posix_spawn_file_actions_addfchdir_np 3 ,
+.Xr posix_spawn_file_actions_addfchdir 3 ,
.Xr posix_spawn_file_actions_addopen 3 ,
.Xr posix_spawn_file_actions_destroy 3 ,
.Xr posix_spawn_file_actions_init 3 ,
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index 656c0f20f798..11cdb5a29d03 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -549,6 +549,8 @@ posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *
STAILQ_INSERT_TAIL(&(*fa)->fa_list, fae, fae_list);
return (0);
}
+__weak_reference(posix_spawn_file_actions_addchdir_np,
+ posix_spawn_file_actions_addchdir);
int
posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *__restrict fa,
@@ -571,6 +573,9 @@ posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *__restrict fa,
return (0);
}
+__weak_reference(posix_spawn_file_actions_addfchdir_np,
+ posix_spawn_file_actions_addfchdir);
+
int
posix_spawn_file_actions_addclosefrom_np (posix_spawn_file_actions_t *
__restrict fa, int from)
diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3
index 80bc91454471..1d0eac45f872 100644
--- a/lib/libc/gen/posix_spawn_file_actions_addopen.3
+++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3
@@ -40,8 +40,8 @@
.Nm posix_spawn_file_actions_adddup2 ,
.Nm posix_spawn_file_actions_addclose ,
.Nm posix_spawn_file_actions_addclosefrom_np ,
-.Nm posix_spawn_file_actions_addchdir_np ,
-.Nm posix_spawn_file_actions_addfchdir_np
+.Nm posix_spawn_file_actions_addchdir ,
+.Nm posix_spawn_file_actions_addfchdir
.Nd "add open, dup2, close, closefrom, or chdir/fchdir actions to spawn file actions object"
.Sh LIBRARY
.Lb libc
@@ -72,12 +72,12 @@
.Fa "int from"
.Fc
.Ft int
-.Fo posix_spawn_file_actions_addchdir_np
+.Fo posix_spawn_file_actions_addchdir
.Fa "posix_spawn_file_actions_t *restrict file_actions"
.Fa "const char *restrict path"
.Fc
.Ft int
-.Fo posix_spawn_file_actions_addfchdir_np
+.Fo posix_spawn_file_actions_addfchdir
.Fa "posix_spawn_file_actions_t * file_actions"
.Fa "int fildes"
.Fc
@@ -189,9 +189,9 @@ For each open file descriptor, logically the close action is performed,
and any possible errors encountered are ignored.
.Pp
The
-.Fn posix_spawn_file_actions_addchdir_np
+.Fn posix_spawn_file_actions_addchdir
and
-.Fn posix_spawn_file_actions_addfchdir_np
+.Fn posix_spawn_file_actions_addfchdir
functions add a change current directory action to the object
referenced by
.Fa file_actions
@@ -201,11 +201,11 @@ in the order of insertion into the
object.
It also sets the working directory for the spawned program.
The
-.Fn posix_spawn_file_actions_addchdir_np
+.Fn posix_spawn_file_actions_addchdir
function takes the
.Fa path
to set as the working directory, while
-.Fn posix_spawn_file_actions_addfchdir_np
+.Fn posix_spawn_file_actions_addfchdir
takes the directory file descriptor.
.Sh RETURN VALUES
Upon successful completion, these functions return zero;
@@ -250,11 +250,8 @@ is equal to
A future update of the Standard is expected to require this behavior.
.Pp
The
-.Fn posix_spawn_file_actions_addchdir_np ,
-.Fn posix_spawn_file_actions_addfchdir_np ,
-and
.Fn posix_spawn_file_actions_addclosefrom_np
-functions are non-standard functions implemented after the similar
+function is non-standard and implemented after the similar
functionality provided by glibc.
.Sh HISTORY
The
@@ -271,5 +268,13 @@ and
.Fn posix_spawn_file_actions_addclosefrom_np
functions first appeared in
.Fx 13.1 .
+In
+.Fx 16.0 ,
+the
+.Fn posix_spawn_file_actions_addchdir ,
+.Fn posix_spawn_file_actions_addfchdir
+aliases where added to the corresponding functions with the
+.Ql _np
+suffix.
.Sh AUTHORS
.An \&Ed Schouten Aq Mt ed@FreeBSD.org