aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/posix_spawn_file_actions_addopen.3
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen/posix_spawn_file_actions_addopen.3')
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_addopen.386
1 files changed, 79 insertions, 7 deletions
diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3
index 0b57999bf4be..80bc91454471 100644
--- a/lib/libc/gen/posix_spawn_file_actions_addopen.3
+++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3
@@ -32,26 +32,55 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 9, 2013
.Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3
.Os
.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_addclosefrom_np ,
+.Nm posix_spawn_file_actions_addchdir_np ,
+.Nm posix_spawn_file_actions_addfchdir_np
+.Nd "add open, dup2, close, closefrom, or chdir/fchdir actions to spawn file actions object"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In spawn.h
.Ft int
-.Fn posix_spawn_file_actions_addopen "posix_spawn_file_actions_t * file_actions" "int fildes" "const char *restrict path" "int oflag" "mode_t mode"
+.Fo posix_spawn_file_actions_addopen
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fa "const char *restrict path"
+.Fa "int oflag"
+.Fa "mode_t mode"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_adddup2
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fa "int newfildes"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_addclose
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fc
.Ft int
-.Fn posix_spawn_file_actions_adddup2 "posix_spawn_file_actions_t * file_actions" "int fildes" "int newfildes"
+.Fo posix_spawn_file_actions_addclosefrom_np
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int from"
+.Fc
.Ft int
-.Fn posix_spawn_file_actions_addclose "posix_spawn_file_actions_t * file_actions" "int fildes"
+.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.
@@ -150,6 +179,34 @@ close(fildes)
.Pp
had been called) when a new process is spawned using this file actions
object.
+.Pp
+The
+.Fn posix_spawn_file_actions_addclosefrom_np
+function adds a close action to close all file descriptors numerically
+equal or greater then the argument
+.Fa from .
+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
+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.
@@ -191,6 +248,14 @@ 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 ,
+.Fn posix_spawn_file_actions_addfchdir_np ,
+and
+.Fn posix_spawn_file_actions_addclosefrom_np
+functions are non-standard functions implemented after the similar
+functionality provided by glibc.
.Sh HISTORY
The
.Fn posix_spawn_file_actions_addopen ,
@@ -199,5 +264,12 @@ and
.Fn posix_spawn_file_actions_addclose
functions first appeared in
.Fx 8.0 .
+The
+.Fn posix_spawn_file_actions_addchdir_np ,
+.Fn posix_spawn_file_actions_addfchdir_np ,
+and
+.Fn posix_spawn_file_actions_addclosefrom_np
+functions first appeared in
+.Fx 13.1 .
.Sh AUTHORS
.An \&Ed Schouten Aq Mt ed@FreeBSD.org