Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/posix_spawn_file_actions_addopen.3
Show All 34 Lines | ||||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | |||||||||
.\" | .\" | |||||||||
.Dd May 9, 2013 | .Dd May 9, 2013 | |||||||||
.Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3 | .Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3 | |||||||||
.Os | .Os | |||||||||
.Sh NAME | .Sh NAME | |||||||||
.Nm posix_spawn_file_actions_addopen , | .Nm posix_spawn_file_actions_addopen , | |||||||||
.Nm posix_spawn_file_actions_adddup2 , | .Nm posix_spawn_file_actions_adddup2 , | |||||||||
.Nm posix_spawn_file_actions_addclose | .Nm posix_spawn_file_actions_addclose , | |||||||||
.Nd "add open, dup2 or close action to spawn file actions object" | .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 | .Sh LIBRARY | |||||||||
.Lb libc | .Lb libc | |||||||||
.Sh SYNOPSIS | .Sh SYNOPSIS | |||||||||
.In spawn.h | .In spawn.h | |||||||||
.Ft int | .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 | .Ft int | |||||||||
.Fn posix_spawn_file_actions_adddup2 "posix_spawn_file_actions_t * file_actions" "int fildes" "int newfildes" | .Fo posix_spawn_file_actions_adddup2 | |||||||||
.Fa "posix_spawn_file_actions_t * file_actions" | ||||||||||
.Fa "int fildes" | ||||||||||
.Fa "int newfildes" | ||||||||||
.Fc | ||||||||||
.Ft int | .Ft int | |||||||||
.Fn posix_spawn_file_actions_addclose "posix_spawn_file_actions_t * file_actions" "int fildes" | .Fo posix_spawn_file_actions_addclose | |||||||||
.Fa "posix_spawn_file_actions_t * file_actions" | ||||||||||
.Fa "int fildes" | ||||||||||
.Fc | ||||||||||
.Ft int | ||||||||||
.Fo posix_spawn_file_actions_addclosefrom_np | ||||||||||
.Fa "posix_spawn_file_actions_t * file_actions" | ||||||||||
.Fa "int from" | ||||||||||
.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 | .Sh DESCRIPTION | |||||||||
These functions add an open, dup2 or close action to a spawn | These functions add an open, dup2 or close action to a spawn | |||||||||
file actions object. | file actions object. | |||||||||
.Pp | .Pp | |||||||||
A spawn file actions object is of type | A spawn file actions object is of type | |||||||||
.Vt posix_spawn_file_actions_t | .Vt posix_spawn_file_actions_t | |||||||||
(defined in | (defined in | |||||||||
.In spawn.h ) | .In spawn.h ) | |||||||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | ||||||||||
.Fa fildes | .Fa fildes | |||||||||
to be closed (as if | to be closed (as if | |||||||||
.Bd -literal -offset indent | .Bd -literal -offset indent | |||||||||
close(fildes) | close(fildes) | |||||||||
.Ed | .Ed | |||||||||
.Pp | .Pp | |||||||||
had been called) when a new process is spawned using this file actions | had been called) when a new process is spawned using this file actions | |||||||||
object. | 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. | ||||||||||
kevansUnsubmitted Done Inline Actions
kevans: | ||||||||||
The | ||||||||||
.Fn posix_spawn_file_actions_addchdir_np | ||||||||||
function takes the | ||||||||||
Done Inline Actions
kevans: | ||||||||||
.Fa path | ||||||||||
to set as the working directory, while | ||||||||||
.Fn posix_spawn_file_actions_addfchdir_np | ||||||||||
takes the directory file descriptor. | ||||||||||
.Sh RETURN VALUES | .Sh RETURN VALUES | |||||||||
Upon successful completion, these functions return zero; | Upon successful completion, these functions return zero; | |||||||||
otherwise, an error number is returned to indicate the error. | otherwise, an error number is returned to indicate the error. | |||||||||
.Sh ERRORS | .Sh ERRORS | |||||||||
These | These | |||||||||
functions fail if: | functions fail if: | |||||||||
.Bl -tag -width Er | .Bl -tag -width Er | |||||||||
.It Bq Er EBADF | .It Bq Er EBADF | |||||||||
Show All 25 Lines | ||||||||||
.Fn posix_spawn_file_actions_adddup2 | .Fn posix_spawn_file_actions_adddup2 | |||||||||
if | if | |||||||||
.Fa fildes | .Fa fildes | |||||||||
is equal to | is equal to | |||||||||
.Fa newfildes | .Fa newfildes | |||||||||
(clearing | (clearing | |||||||||
.Dv FD_CLOEXEC ) . | .Dv FD_CLOEXEC ) . | |||||||||
A future update of the Standard is expected to require this behavior. | 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 | ||||||||||
Done Inline Actions
kevans: | ||||||||||
functionality provided by glibc. | ||||||||||
Done Inline ActionsNon-blocking comment: is there a macro that could be used along with mentioning glibc? Also, should it glibc or GNU libc? ngie: Non-blocking comment: is there a macro that could be used along with mentioning glibc? Also… | ||||||||||
Done Inline ActionsI do not think we have or would ever have such macro. Official GNU project is called The GNU C Library (glibc), and they call themself glibc. kib: I do not think we have or would ever have such macro. Official GNU project is called `The GNU… | ||||||||||
.Sh HISTORY | .Sh HISTORY | |||||||||
The | The | |||||||||
.Fn posix_spawn_file_actions_addopen , | .Fn posix_spawn_file_actions_addopen , | |||||||||
.Fn posix_spawn_file_actions_adddup2 | .Fn posix_spawn_file_actions_adddup2 | |||||||||
and | and | |||||||||
.Fn posix_spawn_file_actions_addclose | .Fn posix_spawn_file_actions_addclose | |||||||||
functions first appeared in | functions first appeared in | |||||||||
.Fx 8.0 . | .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 14.0 . | ||||||||||
.Sh AUTHORS | .Sh AUTHORS | |||||||||
.An \&Ed Schouten Aq Mt ed@FreeBSD.org | .An \&Ed Schouten Aq Mt ed@FreeBSD.org |