aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-11-28 00:11:21 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-12-07 00:25:55 +0000
commitef39284e945b13ea2056724b93cdcac786ab3183 (patch)
treeb853f5325fde772488af8eac4f6ad797c5cac8a0
parentc7b624979a60816251f848f0c460aa2c11712c23 (diff)
downloadsrc-ef39284e945b13ea2056724b93cdcac786ab3183.tar.gz
src-ef39284e945b13ea2056724b93cdcac786ab3183.zip
Document posix_spawn_file_actions_addchdir_np(3)
(cherry picked from commit bd44dce5b3176c19a9435a5e7e125fc06182fbc9)
-rw-r--r--lib/libc/gen/Makefile.inc2
-rw-r--r--lib/libc/gen/posix_spawn.34
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_addopen.349
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_init.32
4 files changed, 53 insertions, 4 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index aa9a4c0cbf67..47724bc347c9 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -462,6 +462,8 @@ MLINKS+=popen.3 pclose.3
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_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_init.3 posix_spawn_file_actions_destroy.3 \
posix_spawnattr_getflags.3 posix_spawnattr_setflags.3 \
posix_spawnattr_getpgroup.3 posix_spawnattr_setpgroup.3 \
diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3
index 12df7dc41875..848733a41a7d 100644
--- a/lib/libc/gen/posix_spawn.3
+++ b/lib/libc/gen/posix_spawn.3
@@ -34,7 +34,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 5, 2016
+.Dd November 28, 2021
.Dt POSIX_SPAWN 3
.Os
.Sh NAME
@@ -436,6 +436,8 @@ including trying to close a descriptor that is not open.
.Xr posix_spawn_file_actions_addclose 3 ,
.Xr posix_spawn_file_actions_adddup2 3 ,
.Xr posix_spawn_file_actions_addopen 3 ,
+.Xr posix_spawn_file_actions_addchdir_np 3 ,
+.Xr posix_spawn_file_actions_addfchdir_np 3 ,
.Xr posix_spawn_file_actions_destroy 3 ,
.Xr posix_spawn_file_actions_init 3 ,
.Xr posix_spawnattr_destroy 3 ,
diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3
index 5cecb49a614d..b364e92c18f8 100644
--- a/lib/libc/gen/posix_spawn_file_actions_addopen.3
+++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3
@@ -40,8 +40,10 @@
.Sh NAME
.Nm posix_spawn_file_actions_addopen ,
.Nm posix_spawn_file_actions_adddup2 ,
-.Nm posix_spawn_file_actions_addclose
-.Nd "add open, dup2 or close action to spawn file actions object"
+.Nm posix_spawn_file_actions_addclose ,
+.Nm posix_spawn_file_actions_addchdir_np ,
+.Nm posix_spawn_file_actions_addfchdir_np
+.Nd "add open, dup2, close, or chdir/fchdir actions to spawn file actions object"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
@@ -65,6 +67,16 @@
.Fa "posix_spawn_file_actions_t * file_actions"
.Fa "int fildes"
.Fc
+.Ft int
+.Fo posix_spawn_file_actions_addchdir_np
+.Fa "posix_spawn_file_actions_t *restrict file_actions"
+.Fa "const char *restrict path"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_addfchdir_np
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fc
.Sh DESCRIPTION
These functions add an open, dup2 or close action to a spawn
file actions object.
@@ -163,6 +175,26 @@ close(fildes)
.Pp
had been called) when a new process is spawned using this file actions
object.
+.Pp
+The
+.Fn posix_spawn_file_actions_addchdir_np
+and
+.Fn posix_spawn_file_actions_addfchdir_np
+functions add a change current directory action to the object
+referenced by
+.Fa file_actions
+that affects actions (opens with relative path) performed after the operation,
+in the order of insertion into the
+.Fa file_actions
+object.
+It also sets the working directory for the spawned program.
+The
+.Fn posix_spawn_file_actions_addchdir_np
+function takes the
+.Fa path
+to set as the working directory, while
+.Fn posix_spawn_file_actions_addfchdir_np
+takes the directory file descriptor.
.Sh RETURN VALUES
Upon successful completion, these functions return zero;
otherwise, an error number is returned to indicate the error.
@@ -204,6 +236,13 @@ is equal to
(clearing
.Dv FD_CLOEXEC ) .
A future update of the Standard is expected to require this behavior.
+.Pp
+The
+.Fn posix_spawn_file_actions_addchdir_np
+and
+.Fn posix_spawn_file_actions_addfchdir_np
+functions are non-standard functions implemented after the similar
+functionality provided by glibc.
.Sh HISTORY
The
.Fn posix_spawn_file_actions_addopen ,
@@ -212,5 +251,11 @@ and
.Fn posix_spawn_file_actions_addclose
functions first appeared in
.Fx 8.0 .
+The
+.Fn posix_spawn_file_actions_addchdir_np
+and
+.Fn posix_spawn_file_actions_addfchdir_np
+functions first appeared in
+.Fx 14.0 .
.Sh AUTHORS
.An \&Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3
index 380eed769003..31b62beed570 100644
--- a/lib/libc/gen/posix_spawn_file_actions_init.3
+++ b/lib/libc/gen/posix_spawn_file_actions_init.3
@@ -34,7 +34,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 24, 2008
+.Dd November 28, 2021
.Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3
.Os
.Sh NAME