diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-04-11 08:11:31 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-04-11 08:11:31 +0000 |
commit | bfd630b90296b38447d1243f26bbbf5076b0d126 (patch) | |
tree | 388828b16ce25e81f332be6d0eb639c2a996406d /lib/libc | |
parent | b834bd6a7fcd42ce64586f8c3bb3950d73ffb72b (diff) |
new clean-room manpages for posix_spawn, unencumbered by any POSIX bullshit.
"just commit it" deraadt@
(nits to be fixed soon)
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 18 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawn.3 | 434 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawn_file_actions_addopen.3 | 193 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawn_file_actions_init.3 | 92 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getflags.3 | 119 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getpgroup.3 | 100 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getschedparam.3 | 90 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getschedpolicy.3 | 88 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getsigdefault.3 | 88 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_getsigmask.3 | 88 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawnattr_init.3 | 119 |
11 files changed, 333 insertions, 1096 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 56eb0518850..e08baaffcf4 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.56 2012/03/22 01:13:40 matthew Exp $ +# $OpenBSD: Makefile.inc,v 1.57 2012/04/11 08:11:30 espie Exp $ # gen sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen @@ -60,9 +60,7 @@ MAN+= alarm.3 auth_subr.3 authenticate.3 basename.3 clock.3 confstr.3 \ isxdigit.3 ldexp.3 lockf.3 login_cap.3 modf.3 nice.3 nlist.3 pause.3 \ popen.3 posix_spawn.3 posix_spawn_file_actions_addopen.3 \ posix_spawn_file_actions_init.3 posix_spawnattr_getflags.3 \ - posix_spawnattr_getpgroup.3 posix_spawnattr_getschedparam.3 \ - posix_spawnattr_getschedpolicy.3 posix_spawnattr_getsigdefault.3 \ - posix_spawnattr_getsigmask.3 posix_spawnattr_init.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_init.3 \ psignal.3 pw_dup.3 pwcache.3 raise.3 readpassphrase.3 \ scandir.3 setjmp.3 setmode.3 setproctitle.3 siginterrupt.3 signal.3 \ sigsetops.3 sleep.3 statvfs.3 sysconf.3 sysctl.3 strtofflags.3 \ @@ -134,11 +132,15 @@ MLINKS+=modf.3 modff.3 modf.3 modfl.3 MLINKS+=popen.3 pclose.3 MLINKS+=posix_spawn.3 posix_spawnp.3 \ posix_spawnattr_init.3 posix_spawnattr_destroy.3 \ - posix_spawnattr_getsigmask.3 posix_spawnattr_setsigmask.3 \ - posix_spawnattr_getsigdefault.3 posix_spawnattr_setsigdefault.3 \ - posix_spawnattr_getschedpolicy.3 posix_spawnattr_setschedpolicy.3 \ - posix_spawnattr_getschedparam.3 posix_spawnattr_setschedparam.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_setsigmask.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_setsigdefault.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_setschedpolicy.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_setschedparam.3 \ posix_spawnattr_getpgroup.3 posix_spawnattr_setpgroup.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_getschedparam.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_getschedpolicy.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_getsigdefault.3 \ + posix_spawnattr_getpgroup.3 posix_spawnattr_getsigmask.3 \ posix_spawnattr_getflags.3 posix_spawnattr_setflags.3 \ posix_spawn_file_actions_init.3 posix_spawn_file_actions_destroy.3 \ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_adddup2.3 \ diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3 index 723984b215d..fe3c8fbc046 100644 --- a/lib/libc/gen/posix_spawn.3 +++ b/lib/libc/gen/posix_spawn.3 @@ -1,385 +1,129 @@ -.\" $OpenBSD: posix_spawn.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawn.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .Dt POSIX_SPAWN 3 .Os .Sh NAME -.Nm posix_spawn , -.Nm posix_spawnp -.Nd "spawn a process" +.Nm posix_spawn , posix_spawnp +.Nd launch external command .Sh SYNOPSIS .In spawn.h .Ft int -.Fn posix_spawn "pid_t *restrict pid" "const char *restrict path" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]" +.Fn posix_spawn "pid_t *restrict pidp" "const char *restrict path" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]" .Ft int -.Fn posix_spawnp "pid_t *restrict pid" "const char *restrict file" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]" +.Fn posix_spawnp "pid_t *restrict pidp" "const char *restrict file" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]" .Sh DESCRIPTION The .Fn posix_spawn -and -.Fn posix_spawnp -functions create a new process (child process) from the specified -process image. -The new process image is constructed from a regular executable -file called the new process image file. -.Pp -When a C program is executed as the result of this call, it is -entered as a C-language function call as follows: -.Bd -literal -offset indent -int main(int argc, char *argv[]); -.Ed -.Pp -where -.Fa argc -is the argument count and -.Fa argv -is an array of character pointers to the arguments themselves. -In addition, the variable: -.Bd -literal -offset indent -extern char **environ; -.Ed -.Pp -points to an array of character pointers to -the environment strings. -.Pp -The argument -.Fa argv -is an array of character pointers to null-terminated -strings. -The last member of this array is a null pointer and is not counted -in -.Fa argc . -These strings constitute the argument list available to the new process -image. -The value in -.Fa argv Ns [0] -should point to -a filename that is associated with the process image being started by -the -.Fn posix_spawn -or -.Fn posix_spawnp -function. -.Pp -The argument -.Fa envp -is an array of character pointers to null-terminated strings. -These strings constitute the environment for the new process image. -The environment array is terminated by a null pointer. -.Pp -The -.Fa path -argument to -.Fn posix_spawn -is a pathname that identifies the new process image file to execute. +function forks a new process and starts an external program from +pathname +.Fa path . .Pp The +.Fn posix_spawnp +function is similar, except it constructs the pathname from .Fa file -parameter to +following usual +.Ev PATH +handling rules: +if file contains a slash, then it is directly used as a path. +Otherwise, .Fn posix_spawnp -is used to construct a pathname that identifies the new process -image file. -If the file parameter contains a slash character, the file parameter -is used as the pathname for the new process image file. -Otherwise, the path prefix for this file is obtained by a search -of the directories passed as the environment variable -.Dq Ev PATH . -If this variable is not specified, -the default path is set according to the -.Dv _PATH_DEFPATH -definition in -.In paths.h , -which is set to -.Dq Ev /usr/bin:/bin . +search every directory mentioned in +.Ev PATH +until it finds an executable. +If +.Ev PATH +is not set, the default is +.Dq /usr/bin:/bin . .Pp +Arguments to the new process are passed to +.Xr execve 2 +as +.Fa argv +and +.Fa envp . If -.Fa file_actions -is a null pointer, then file descriptors open in the -calling process remain open in the child process, except for those -whose close-on-exec flag -.Dv FD_CLOEXEC -is set (see -.Fn fcntl ) . -For those -file descriptors that remain open, all attributes of the corresponding -open file descriptions, including file locks (see -.Fn fcntl ) , -remain unchanged. +.Fa envp +is NULL, the environment is passed unchanged from the parent process. .Pp If .Fa file_actions -is not NULL, then the file descriptors open in the child process are -those open in the calling process as modified by the spawn file -actions object pointed to by -.Fa file_actions -and the -.Dv FD_CLOEXEC -flag of each remaining open file descriptor after the spawn file actions -have been processed. -The effective order of processing the spawn file actions are: -.Bl -enum -.It -The set of open file descriptors for the child process initially -are the same set as is open for the calling process. -All attributes of the corresponding open file descriptions, including -file locks (see -.Fn fcntl ) , -remain unchanged. -.It -The signal mask, signal default actions, and the effective user and -group IDs for the child process are changed as specified in the -attributes object referenced by -.Fa attrp . -.It -The file actions specified by the spawn file actions object are -performed in the order in which they were added to the spawn file -actions object. -.It -Any file descriptor that has its -.Dv FD_CLOEXEC -flag set (see -.Fn fcntl ) -is closed. -.El -.Pp -The -.Vt posix_spawnattr_t -spawn attributes object type is defined in -.In spawn.h . -It contains the attributes defined below. -.Pp -If the -.Dv POSIX_SPAWN_SETPGROUP -flag is set in the spawn-flags attribute of the object referenced by -.Fa attrp , -and the spawn-pgroup attribute of the same object is non-zero, then the -child's process group is as specified in the spawn-pgroup -attribute of the object referenced by -.Fa attrp . -.Pp -As a special case, if the -.Dv POSIX_SPAWN_SETPGROUP -flag is set in the spawn-flags attribute of the object referenced by -.Fa attrp , -and the spawn-pgroup attribute of the same object is set to zero, then -the child is in a new process group with a process group ID equal -to its process ID. -.Pp -If the -.Dv POSIX_SPAWN_SETPGROUP -flag is not set in the spawn-flags attribute of the object referenced by -.Fa attrp , -the new child process inherits the parent's process group. -.Pp -The -.Dv POSIX_SPAWN_RESETIDS -flag in the spawn-flags attribute of the object referenced by -.Fa attrp -governs the effective user ID of the child process. -If this flag is not set, the child process inherits the parent -process' effective user ID. -If this flag is set, the child process' effective user ID is reset -to the parent's real user ID. -In either case, if the set-user-ID mode bit of the new process image -file is set, the effective user ID of the child process becomes -that file's owner ID before the new process image begins execution. +is a null pointer, file descriptors open in the parent process +follow the usual rules: they remain open in the child process unless they've +been marked +.Ev FD_CLOEXEC +with +.Xr fcntl 2 . +.Pp +Otherwise, file descriptors in the child process +are altered according to +.Xr posix_spawn_file_actions_init 3 , +.Xr posix_spawn_file_actions_addclose 3 , +.Xr posix_spawn_file_actions_adddup2 3 , +.Xr posix_spawn_file_actions_addopen 3 . .Pp The -.Dv POSIX_SPAWN_RESETIDS -flag in the spawn-flags attribute of the object referenced by -.Fa attrp -also governs the effective group ID of the child process. -If this flag is not set, the child process inherits the parent -process' effective group ID. -If this flag is set, the child process' effective group ID is -reset to the parent's real group ID. -In either case, if the set-group-ID mode bit of the new process image -file is set, the effective group ID of the child process becomes -that file's group ID before the new process image begins execution. -.Pp -If the -.Dv POSIX_SPAWN_SETSIGMASK -flag is set in the spawn-flags attribute of the object referenced by -.Fa attrp , -the child process initially has the signal mask specified in the -spawn-sigmask attribute of the object referenced by -.Fa attrp . -.Pp -If the -.Dv POSIX_SPAWN_SETSIGDEF -flag is set in the spawn-flags attribute of the object referenced by -.Fa attrp , -the signals specified in the spawn-sigdefault attribute of the same -object is set to their default actions in the child process. -Signals set to the default action in the parent process is set to -the default action in the child process. -.Pp -Signals set to be caught by the calling process is set to the -default action in the child process. -.Pp -Signals set to be ignored by the calling process image is set to -be ignored by the child process, unless otherwise specified by the -.Dv POSIX_SPAWN_SETSIGDEF -flag being set in the spawn-flags attribute of the object referenced by .Fa attrp -and the signals being indicated in the spawn-sigdefault attribute -of the object referenced by -.Fa attrp . +argument can be used to control signal, uid and gid handling in the +child process. .Pp -If the value of the +If .Fa attrp -pointer is NULL, then the default values are used. +is NULL, default values are used: caught signals in the parent +process are set to the default value in the child process, and ignored signals +stay ignored. .Pp -All process attributes, other than those influenced by the attributes -set in the object referenced by -.Fa attrp -as specified above or by the file descriptor manipulations specified in -.Fa file_actions , -appear in the new process image as though -.Fn fork -had been called to create a child process and then -.Fn execve -had been called by the child process to execute the new process image. +See +.Xr posix_spawnattr_init 3 , +.Xr posix_spawnattr_setflags 3 , +.Xr posix_spawnattr_setpgroup 3 , +.Xr posix_spawnattr_setschedparam 3 , +.Xr posix_spawnattr_setsigdefault 3 , +.Xr posix_spawnattr_setsigmask 3 +for attribute details. .Sh RETURN VALUES -Upon successful completion, -.Fn posix_spawn -and -.Fn posix_spawnp -return the process ID of the child process to the parent process, -in the variable pointed to by a non-NULL -.Fa pid -argument, and return zero as the function return value. -Otherwise, no child process is created, no value is stored into -the variable pointed to by -.Fa pid , -and an error number is returned as the function return value to -indicate the error. -If the -.Fa pid -argument is a null pointer, the process ID of the child is not returned -to the caller. -.Sh ERRORS -.Bl -enum -.It +Upon succesful completion, both functions return 0. If -.Fn posix_spawn -and -.Fn posix_spawnp -fail for any of the reasons that would cause -.Fn fork -or one of the -.Nm exec -to fail, an error value is returned as described by +.Fa pidp +is not a NULL pointer, +.Li *pidp +gets set to the pid of the newly created child process. +.Pp +In case of an error, both functions may return .Fn fork -and -.Nm exec , -respectively (or, if the error occurs after the calling process successfully -returns, the child process exits with exit status 127). -.It -If -.Nm POSIX_SPAWN_SETPGROUP -is set in the spawn-flags attribute of the object referenced by attrp, and -.Fn posix_spawn -or -.Fn posix_spawnp -fails while changing the child's process group, an error value is returned as -described by -.Fn setpgid -(or, if the error occurs after the calling process successfully returns, -the child process exits with exit status 127). -.It -If the -.Fa file_actions -argument is not NULL, and specifies any close, dup2, or open actions to be -performed, and if -.Fn posix_spawn -or -.Fn posix_spawnp -fails for any of the reasons that would cause -.Fn close , -.Fn dup2 , or -.Fn open -to fail, an error value is returned as described by -.Fn close , -.Fn dup2 , -and -.Fn open , -respectively (or, if the error occurs after the calling process successfully -returns, the child process exits with exit status 127). An open file action -may, by itself, result in any of the errors described by -.Fn close -or -.Fn dup2 , -in addition to those described by -.Fn open . -.El +.Nm exec +return values and set +.Ev errno +accordingly. +.Pp +Note, however, that after the new process is started, the child +process has no way to return an error value. +In case of a problem, the child process will instead exit +with exit status 127. .Sh SEE ALSO -.Xr close 2 , -.Xr dup2 2 , .Xr execve 2 , -.Xr fcntl 2 , .Xr fork 2 , -.Xr open 2 , -.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_destroy 3 , .Xr posix_spawn_file_actions_init 3 , -.Xr posix_spawnattr_destroy 3 , -.Xr posix_spawnattr_getflags 3 , -.Xr posix_spawnattr_getpgroup 3 , -.Xr posix_spawnattr_getschedparam 3 , -.Xr posix_spawnattr_getschedpolicy 3 , -.Xr posix_spawnattr_getsigdefault 3 , -.Xr posix_spawnattr_getsigmask 3 , -.Xr posix_spawnattr_init 3 , -.Xr posix_spawnattr_setflags 3 , -.Xr posix_spawnattr_setpgroup 3 , -.Xr posix_spawnattr_setschedparam 3 , -.Xr posix_spawnattr_setschedpolicy 3 , -.Xr posix_spawnattr_setsigdefault 3 , -.Xr posix_spawnattr_setsigmask 3 , -.Xr setpgid 2 +.Xr posix_spawn_file_actions_addclose 3 , +.Xr posix_spawnattr_init 3 . .Sh STANDARDS -The -.Fn posix_spawn -and -.Fn posix_spawnp -functions conform to +Both functions conform to .St -p1003.1-2001 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Shouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3 index e07b4b3e079..0195bf2f912 100644 --- a/lib/libc/gen/posix_spawn_file_actions_addopen.3 +++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3 @@ -1,170 +1,101 @@ -.\" $OpenBSD: posix_spawn_file_actions_addopen.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawn_file_actions_addopen.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .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_adddup2 , +.Nm posix_spawn_file_actions_addopen , +.Nd "add action to close, dup2 or open file descriptor to file actions object" .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" +.Fn posix_spawn_file_actions_addclose "posix_spawn_file_actions_t *file_actions" "int fildes" .Ft int .Fn posix_spawn_file_actions_adddup2 "posix_spawn_file_actions_t *file_actions" "int fildes" "int newfildes" .Ft int -.Fn posix_spawn_file_actions_addclose "posix_spawn_file_actions_t *file_actions" "int fildes" +.Fn posix_spawn_file_actions_addopen "posix_spawn_file_actions_t *file_actions" "int fildes" "const char *restrict path" "int oflag" "mode_t mode" .Sh DESCRIPTION -These functions add an open, dup2 or close action to a spawn +These function add an action to +.Xr close 2 , +.Xr dup2 2 , +or +.Xr open 2 +a file descriptor +to a +.Xr posix_spawn 3 file actions object. .Pp -A spawn file actions object is of type -.Vt posix_spawn_file_actions_t -(defined in -.In spawn.h ) -and is used to specify a series of actions to be performed by a -.Fn posix_spawn -or -.Fn posix_spawnp -operation in order to arrive at the set of open file descriptors for the -child process given the set of open file descriptors of the parent. -.Pp -A spawn file actions object, when passed to -.Fn posix_spawn -or -.Fn posix_spawnp , -specify how the set of open file descriptors in the calling -process is transformed into a set of potentially open file descriptors -for the spawned process. -This transformation is as if the specified sequence of actions was -performed exactly once, in the context of the spawned process (prior to -execution of the new process image), in the order in which the actions -were added to the object; additionally, when the new process image is -executed, any file descriptor (from this new set) which has its -.Dv FD_CLOEXEC -flag set is closed (see -.Fn posix_spawn ) . -.Pp +Actions are executed in order in the child process: +.Bl -dash +.It The -.Fn posix_spawn_file_actions_addopen -function adds an open action to the object referenced by -.Fa file_actions -that causes the file named by -.Fa path -to be opened (as if +.Fn posix_spawn_file_actions_addclose +function adds an action that causes .Bd -literal -offset indent -open(path, oflag, mode) +close(fildes); .Ed .Pp -had been called, and the returned file descriptor, if not -.Fa fildes , -had been changed to -.Fa fildes ) -when a new process is spawned using this file actions object. -If -.Fa fildes -was already an open file descriptor, it is closed before the new -file is opened. -.Pp -The string described by -.Fa path -is copied by the -.Fn posix_spawn_file_actions_addopen -function. -.Pp +to be called. +.It The .Fn posix_spawn_file_actions_adddup2 -function adds a dup2 action to the object referenced by -.Fa file_actions -that causes the file descriptor -.Fa fildes -to be duplicated as -.Fa newfildes -(as if +function adds an action that causes .Bd -literal -offset indent -dup2(fildes, newfildes) +dup2(fildes, newfildes); .Ed .Pp -had been called) when a new process is spawned using this file actions object. -.Pp +to be called. +.It The -.Fn posix_spawn_file_actions_addclose -function adds a close action to the object referenced by -.Fa file_actions -that causes the file descriptor -.Fa fildes -to be closed (as if +.Fn posix_spawn_file_actions_addopen +adds an action that causes .Bd -literal -offset indent -close(fildes) +open(path, oflag, mode); .Ed .Pp -had been called) when a new process is spawned using this file actions -object. -.Sh RETURN VALUES -Upon successful completion, these functions return zero; -otherwise, an error number is returned to indicate the error. -.Sh ERRORS -These -functions fail if: -.Bl -tag -width Er -.It Bq Er EINVAL -The value specified by +to be called and the result to be forced as +.Fa fildes . +.Po +If .Fa fildes -or -.Fa newfildes -is negative. -.It Bq Er ENOMEM -Insufficient memory exists to add to the spawn file actions object. -.El +was already open before this action, the old file descriptor +is closed before the action is performed +.Pc +.Pp +Note that +.Fn posix_spawn_file_actions_addopen +makes a copy of the +.Fa path +argument. +.Sh RETURN VALUES +Upon successful completion, these functions return zero. +Otherwise they may return +.Er EINVAL +for negative file descriptors, or +.Er ENOMEM +if they run out of memory. .Sh SEE ALSO -.Xr close 2 , -.Xr dup2 2 , -.Xr open 2 , .Xr posix_spawn 3 , -.Xr posix_spawn_file_actions_destroy 3 , .Xr posix_spawn_file_actions_init 3 , .Xr posix_spawnp 3 .Sh STANDARDS -The -.Fn posix_spawn_file_actions_addopen , -.Fn posix_spawn_file_actions_adddup2 -and -.Fn posix_spawn_file_actions_addclose +Those functions functions conform to .St -p1003.1-2001 . .Sh AUTHORS diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3 index 82255ba1c53..a750fe37cab 100644 --- a/lib/libc/gen/posix_spawn_file_actions_init.3 +++ b/lib/libc/gen/posix_spawn_file_actions_init.3 @@ -1,45 +1,26 @@ -.\" $OpenBSD: posix_spawn_file_actions_init.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawn_file_actions_init.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3 .Os .Sh NAME .Nm posix_spawn_file_actions_init , .Nm posix_spawn_file_actions_destroy -.Nd "initialize and destroy spawn file actions object" +.Nd "create and destroy posix_spawn file actions objects" .Sh SYNOPSIS .In spawn.h .Ft int @@ -47,36 +28,25 @@ .Ft int .Fn posix_spawn_file_actions_destroy "posix_spawn_file_actions_t *file_actions" .Sh DESCRIPTION -The +File actions objects can be initialized by .Fn posix_spawn_file_actions_init -function initialize the object referenced by -.Fn file_actions -to contain no file actions for -.Fn posix_spawn -or -.Fn posix_spawnp . -Initializing an already initialized spawn file actions object may cause -memory to be leaked. +and destroyed by +.Fn posix_spawn_file_actions_destroy. .Pp -The +Multiple initialization of the same object is undefined behavior +and will lead to memory leaks. +.Pp +Similarly, objects should be passed to .Fn posix_spawn_file_actions_destroy -function destroy the object referenced by -.Fa file_actions ; -the object becomes, in effect, uninitialized. -A destroyed spawn file actions object can be reinitialized using +to reclaim memory. +The object should not be re-used after destruction. +It can however be initialized again with .Fn posix_spawn_file_actions_init . -The object should not be used after it has been destroyed. .Sh RETURN VALUES -Upon successful completion, these functions return zero; -otherwise, an error number is returned to indicate the error. -.Sh ERRORS -The -.Fn posix_spawn_file_actions_init -function will fail if: -.Bl -tag -width Er -.It Bq Er ENOMEM -Insufficient memory exists to initialize the spawn file actions object. -.El +These function return 0 on succesful completion. +They may return +.Er ENOMEM +when running out of memory. .Sh SEE ALSO .Xr posix_spawn 3 , .Xr posix_spawn_file_actions_addclose 3 , @@ -84,11 +54,7 @@ Insufficient memory exists to initialize the spawn file actions object. .Xr posix_spawn_file_actions_addopen 3 , .Xr posix_spawnp 3 .Sh STANDARDS -The -.Fn posix_spawn_file_actions_init -and -.Fn posix_spawn_file_actions_destroy -functions conform to +Both functions conform to .St -p1003.1-2001 . .Sh AUTHORS .An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3 index edc86f5116f..15fe245b8f6 100644 --- a/lib/libc/gen/posix_spawnattr_getflags.3 +++ b/lib/libc/gen/posix_spawnattr_getflags.3 @@ -1,45 +1,26 @@ -.\" $OpenBSD: posix_spawnattr_getflags.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawnattr_getflags.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .Dt POSIX_SPAWNATTR_GETFLAGS 3 .Os .Sh NAME .Nm posix_spawnattr_getflags , .Nm posix_spawnattr_setflags -.Nd "get and set the spawn-flags attribute of a spawn attributes object" +.Nd "get and set flags of a posix_spawn attributes object" .Sh SYNOPSIS .In spawn.h .Ft int @@ -49,53 +30,65 @@ .Sh DESCRIPTION The .Fn posix_spawnattr_getflags -function obtains the value of the spawn-flags attribute from the -attributes object referenced by -.Fa attr . -.Pp -The +and .Fn posix_spawnattr_setflags -function sets the spawn-flags attribute in an initialized -attributes object referenced by +functions are used to get or set the flags part of a +posix_spawn attribute object referenced by .Fa attr . .Pp -The spawn-flags attribute is used to indicate which process attributes -are to be changed in the new process image when invoking -.Fn posix_spawn -or -.Fn posix_spawnp . -It is the bitwise-inclusive OR of zero or more of the following flags -(see -.Fn posix_spawn ) : -.Bl -tag -offset indent +Flag values are OR-ed from the following flags: +.Bl -tag -width POSIX_SPAWN .It Dv POSIX_SPAWN_RESETIDS +Reset the effective user and group ID of the spawned process to the parent's +real user and group ID. +.Pp +If the new process is created from a setuid or setgid file, usual +.Xr execve 2 +semantics take precedence. .It Dv POSIX_SPAWN_SETPGROUP +Set process group of the spawned process according to the pgroup attribute +of the object, see +.Xr posix_spawnattr_getpgroup 3 +and +.Xr setpgid 3 . .It Dv POSIX_SPAWN_SETSIGDEF +Reset signals set by +.Xr posix_spawn_setsigdefault 3 +to their default value in the child process. .It Dv POSIX_SPAWN_SETSIGMASK +Set the signal mask of the child process according +to the value set by +.Xr posix_spawnattr_setsigmask 3 . .It Dv POSIX_SPAWN_SETSCHEDPARAM +Set the scheduling parameter of the child process +according to the value set by +.Xr posix_spawnattr_setschedparam 3 +.Po +mandated by +.St -p1003.1-2001 , +this implementation currently does nothing +.Pc . .It Dv POSIX_SPAWN_SETSCHEDULER +Set the scheduler policy of the child process +according to the value set by +.Xr posix_spawnattr_setschedpolicy 3 +.Po +mandated by +.St -p1003.1-2001 , +this implementation currently does nothing +.Pc . .El .Pp -These flags are defined in -.In spawn.h . -The default value of this attribute is as if no flags were set. +.Fn posix_spawnattr_init 3 +initializes this value to no flags set. .Sh RETURN VALUES -The -.Fn posix_spawnattr_getflags -and -.Fn posix_spawnattr_setflags -functions return zero. +Both functions return 0. .Sh SEE ALSO .Xr posix_spawn 3 , -.Xr posix_spawnattr_destroy 3 , .Xr posix_spawnattr_init 3 , .Xr posix_spawnp 3 .Sh STANDARDS -The -.Fn posix_spawnattr_getflags -and -.Fn posix_spawnattr_setflags -functions conform to +Both functions conform to .St -p1003.1-2001 . .Sh AUTHORS .An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getpgroup.3 b/lib/libc/gen/posix_spawnattr_getpgroup.3 index 9c59efcb939..6498f2c96c2 100644 --- a/lib/libc/gen/posix_spawnattr_getpgroup.3 +++ b/lib/libc/gen/posix_spawnattr_getpgroup.3 @@ -1,85 +1,81 @@ -.\" $OpenBSD: posix_spawnattr_getpgroup.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawnattr_getpgroup.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .Dt POSIX_SPAWNATTR_GETPGROUP 3 .Os .Sh NAME .Nm posix_spawnattr_getpgroup , -.Nm posix_spawnattr_setpgroup -.Nd "get and set the spawn-pgroup attribute of a spawn attributes object" +.Nm posix_spawnattr_getschedparam , +.Nm posix_spawnattr_getschedpolicy , +.Nm posix_spawnattr_getsigdefault , +.Nm posix_spawnattr_getsigmask , +.Nm posix_spawnattr_setpgroup , +.Nm posix_spawnattr_setschedparam , +.Nm posix_spawnattr_setschedpolicy , +.Nm posix_spawnattr_setsigdefault , +.Nm posix_spawnattr_setsigmask +.Nd "get and set misc attributes of a posix_spawn attributes object" .Sh SYNOPSIS .In spawn.h .Ft int .Fn posix_spawnattr_getpgroup "const posix_spawnattr_t *restrict attr" "pid_t *restrict pgroup" .Ft int +.Fn posix_spawnattr_getschedparam "const posix_spawnattr_t *restrict attr" "struct sched_param *restrict schedparam" +.Ft int +.Fn posix_spawnattr_getschedpolicy "const posix_spawnattr_t *restrict attr" "int *restrict schedpolicy" +.Ft int +.Fn posix_spawnattr_getsigdefault "const posix_spawnattr_t *restrict attr" "sigset_t *restrict sigdefault" +.Ft int +.Fn posix_spawnattr_getsigmask "const posix_spawnattr_t *restrict attr" "sigset_t *restrict sigmask" +.Ft int .Fn posix_spawnattr_setpgroup "posix_spawnattr_t *attr" "pid_t pgroup" +.Ft int +.Fn posix_spawnattr_setschedparam "posix_spawnattr_t *attr" "const struct sched_param *restrict schedparam" +.Ft int +.Fn posix_spawnattr_setschedpolicy "posix_spawnattr_t *attr" "int schedpolicy" +.Ft int +.Fn posix_spawnattr_setsigdefault "posix_spawnattr_t *attr" "const sigset_t *restrict sigdefault" +.Ft int +.Fn posix_spawnattr_setsigmask "posix_spawnattr_t *attr" "const sigset_t *restrict sigmask" .Sh DESCRIPTION The -.Fn posix_spawnattr_getpgroup -function obtains the value of the spawn-pgroup attribute from the +.Fn posix_spawnattr_get* +functions obtain the value of the corresponding attribute from the attributes object referenced by .Fa attr . .Pp The -.Fn posix_spawnattr_setpgroup -function sets the spawn-pgroup attribute in an initialized +.Fn posix_spawnattr_set* +functions set the value of the corresponding attribute in the attributes object referenced by .Fa attr . .Pp -The spawn-pgroup attribute represents the process group to be joined by -the new process image in a spawn operation (if -.Dv POSIX_SPAWN_SETPGROUP -is set in the spawn-flags attribute). -The default value of this attribute is zero. +See +.Xr posix_spawnattr_getflags 3 +for attribute details. .Sh RETURN VALUES -The -.Fn posix_spawnattr_getpgroup -and -.Fn posix_spawnattr_setpgroup -functions return zero. +Those functions return 0. .Sh SEE ALSO .Xr posix_spawn 3 , .Xr posix_spawnattr_destroy 3 , .Xr posix_spawnattr_init 3 , .Xr posix_spawnp 3 .Sh STANDARDS -The -.Fn posix_spawnattr_getpgroup -and -.Fn posix_spawnattr_setpgroup +Those functions functions conform to .St -p1003.1-2001 . .Sh AUTHORS diff --git a/lib/libc/gen/posix_spawnattr_getschedparam.3 b/lib/libc/gen/posix_spawnattr_getschedparam.3 deleted file mode 100644 index 651df48b866..00000000000 --- a/lib/libc/gen/posix_spawnattr_getschedparam.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" $OpenBSD: posix_spawnattr_getschedparam.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. -.\" -.Dd Mar 24, 2008 -.Dt POSIX_SPAWNATTR_GETSCHEDPARAM 3 -.Os -.Sh NAME -.Nm posix_spawnattr_getschedparam , -.Nm posix_spawnattr_setschedparam -.Nd "get and set the spawn-schedparam attribute of a spawn attributes object" -.Sh SYNOPSIS -.In spawn.h -.Ft int -.Fn posix_spawnattr_getschedparam "const posix_spawnattr_t *restrict attr" "struct sched_param *restrict schedparam" -.Ft int -.Fn posix_spawnattr_setschedparam "posix_spawnattr_t *attr" "const struct sched_param *restrict schedparam" -.Sh DESCRIPTION -The -.Fn posix_spawnattr_getschedparam -function obtains the value of the spawn-schedparam attribute from the -attributes object referenced by -.Fa attr . -.Pp -The -.Fn posix_spawnattr_setschedparam -function sets the spawn-schedparam attribute in an initialized attributes -object referenced by -.Fa attr . -.Pp -The spawn-schedparam attribute represents the scheduling parameters to -be assigned to the new process image in a spawn operation (if -.Dv POSIX_SPAWN_SETSCHEDULER -or -.Dv POSIX_SPAWN_SETSCHEDPARAM -is set in the spawn-flags attribute). -The default value of this attribute is unspecified. -.Sh RETURN VALUES -The -.Fn posix_spawnattr_getschedparam -and -.Fn posix_spawnattr_setschedparam -functions return zero. -.Sh SEE ALSO -.Xr posix_spawn 3 , -.Xr posix_spawnattr_destroy 3 , -.Xr posix_spawnattr_getschedpolicy 3 , -.Xr posix_spawnattr_init 3 , -.Xr posix_spawnattr_setschedpolicy 3 , -.Xr posix_spawnp 3 -.Sh STANDARDS -The -.Fn posix_spawnattr_getschedparam -and -.Fn posix_spawnattr_setschedparam -functions conform to -.St -p1003.1-2001 . -.Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 b/lib/libc/gen/posix_spawnattr_getschedpolicy.3 deleted file mode 100644 index d47b503d67a..00000000000 --- a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" $OpenBSD: posix_spawnattr_getschedpolicy.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. -.\" -.Dd Mar 24, 2008 -.Dt POSIX_SPAWNATTR_GETSCHEDPOLICY 3 -.Os -.Sh NAME -.Nm posix_spawnattr_getschedpolicy , -.Nm posix_spawnattr_setschedpolicy -.Nd "get and set the spawn-schedpolicy attribute of a spawn attributes object" -.Sh SYNOPSIS -.In spawn.h -.Ft int -.Fn posix_spawnattr_getschedpolicy "const posix_spawnattr_t *restrict attr" "int *restrict schedpolicy" -.Ft int -.Fn posix_spawnattr_setschedpolicy "posix_spawnattr_t *attr" "int schedpolicy" -.Sh DESCRIPTION -The -.Fn posix_spawnattr_getschedpolicy -function obtains the value of the spawn-schedpolicy attribute from the -attributes object referenced by -.Fa attr . -.Pp -The -.Fn posix_spawnattr_setschedpolicy -function sets the spawn-schedpolicy attribute in an initialized attributes -object referenced by -.Fa attr . -.Pp -The spawn-schedpolicy attribute represents the scheduling policy to -be assigned to the new process image in a spawn operation (if -.Dv POSIX_SPAWN_SETSCHEDULER -is set in the spawn-flags attribute). -The default value of this attribute is unspecified. -.Sh RETURN VALUES -The -.Fn posix_spawnattr_getschedpolicy -and -.Fn posix_spawnattr_setschedpolicy -functions return zero. -.Sh SEE ALSO -.Xr posix_spawn 3 , -.Xr posix_spawnattr_destroy 3 , -.Xr posix_spawnattr_getschedparam 3 , -.Xr posix_spawnattr_init 3 , -.Xr posix_spawnattr_setschedparam 3 , -.Xr posix_spawnp 3 -.Sh STANDARDS -The -.Fn posix_spawnattr_getschedpolicy -and -.Fn posix_spawnattr_setschedpolicy -functions conform to -.St -p1003.1-2001 . -.Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getsigdefault.3 b/lib/libc/gen/posix_spawnattr_getsigdefault.3 deleted file mode 100644 index eb3db834efe..00000000000 --- a/lib/libc/gen/posix_spawnattr_getsigdefault.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" $OpenBSD: posix_spawnattr_getsigdefault.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. -.\" -.Dd Mar 24, 2008 -.Dt POSIX_SPAWNATTR_GETSIGDEFAULT 3 -.Os -.Sh NAME -.Nm posix_spawnattr_getsigdefault , -.Nm posix_spawnattr_setsigdefault -.Nd "get and set the spawn-sigdefault attribute of a spawn attributes object" -.Sh SYNOPSIS -.In spawn.h -.Ft int -.Fn posix_spawnattr_getsigdefault "const posix_spawnattr_t *restrict attr" "sigset_t *restrict sigdefault" -.Ft int -.Fn posix_spawnattr_setsigdefault "posix_spawnattr_t *attr" "const sigset_t *restrict sigdefault" -.Sh DESCRIPTION -The -.Fn posix_spawnattr_getsigdefault -function obtains the value of the spawn-sigdefault attribute from the -attributes object referenced by -.Fa attr . -.Pp -The -.Fn posix_spawnattr_setsigdefault -function sets the spawn-sigdefault attribute in an initialized attributes -object referenced by -.Fa attr . -.Pp -The spawn-sigdefault attribute represents the set of signals to be forced to -default signal handling in the new process image (if -.Dv POSIX_SPAWN_SETSIGDEF -is set in the spawn-flags attribute) by a spawn operation. -The default value of this attribute is an empty signal set. -.Sh RETURN VALUES -The -.Fn posix_spawnattr_getsigdefault -and -.Fn posix_spawnattr_setsigdefault -functions return zero. -.Sh SEE ALSO -.Xr posix_spawn 3 , -.Xr posix_spawnattr_destroy 3 , -.Xr posix_spawnattr_getsigmask 3 , -.Xr posix_spawnattr_init 3 , -.Xr posix_spawnattr_setsigmask 3 , -.Xr posix_spawnp 3 -.Sh STANDARDS -The -.Fn posix_spawnattr_getsigdefault -and -.Fn posix_spawnattr_setsigdefault -functions conform to -.St -p1003.1-2001 . -.Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getsigmask.3 b/lib/libc/gen/posix_spawnattr_getsigmask.3 deleted file mode 100644 index ed72485166c..00000000000 --- a/lib/libc/gen/posix_spawnattr_getsigmask.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" $OpenBSD: posix_spawnattr_getsigmask.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. -.\" -.Dd Mar 24, 2008 -.Dt POSIX_SPAWNATTR_GETSIGMASK 3 -.Os -.Sh NAME -.Nm posix_spawnattr_getsigmask , -.Nm posix_spawnattr_setsigmask -.Nd "get and set the spawn-sigmask attribute of a spawn attributes object" -.Sh SYNOPSIS -.In spawn.h -.Ft int -.Fn posix_spawnattr_getsigmask "const posix_spawnattr_t *restrict attr" "sigset_t *restrict sigmask" -.Ft int -.Fn posix_spawnattr_setsigmask "posix_spawnattr_t *attr" "const sigset_t *restrict sigmask" -.Sh DESCRIPTION -The -.Fn posix_spawnattr_getsigmask -function obtains the value of the spawn-sigmask attribute from the -attributes object referenced by -.Fa attr . -.Pp -The -.Fn posix_spawnattr_setsigmask -function sets the spawn-sigmask attribute in an initialized attributes -object referenced by -.Fa attr . -.Pp -The spawn-sigmask attribute represents the signal mask in effect in the -new process image of a spawn operation (if -.Dv POSIX_SPAWN_SETSIGMASK -is set in the spawn-flags attribute). -The default value of this attribute is unspecified. -.Sh RETURN VALUES -The -.Fn posix_spawnattr_getsigmask -and -.Fn posix_spawnattr_setsigmask -functions return zero. -.Sh SEE ALSO -.Xr posix_spawn 3 , -.Xr posix_spawnattr_destroy 3 , -.Xr posix_spawnattr_getsigmask 3 , -.Xr posix_spawnattr_init 3 , -.Xr posix_spawnattr_setsigmask 3 , -.Xr posix_spawnp 3 -.Sh STANDARDS -The -.Fn posix_spawnattr_getsigmask -and -.Fn posix_spawnattr_setsigmask -functions conform to -.St -p1003.1-2001 . -.Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_init.3 b/lib/libc/gen/posix_spawnattr_init.3 index 9b2d9b97923..7751c38a512 100644 --- a/lib/libc/gen/posix_spawnattr_init.3 +++ b/lib/libc/gen/posix_spawnattr_init.3 @@ -1,45 +1,26 @@ -.\" $OpenBSD: posix_spawnattr_init.3,v 1.2 2012/03/23 12:58:48 espie Exp $ -.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> -.\" All rights reserved. +.\" $OpenBSD: posix_spawnattr_init.3,v 1.3 2012/04/11 08:11:30 espie Exp $ .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" Portions of this text are reprinted and reproduced in electronic form -.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- -.\" Portable Operating System Interface (POSIX), The Open Group Base -.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of -.\" Electrical and Electronics Engineers, Inc and The Open Group. In the -.\" event of any discrepancy between this version and the original IEEE and -.\" The Open Group Standard, the original IEEE and The Open Group Standard is -.\" the referee document. The original Standard can be obtained online at -.\" http://www.opengroup.org/unix/online.html. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd Mar 24, 2008 +.Dd $Mdocdate: April 11 2012 $ .Dt POSIX_SPAWNATTR_INIT 3 .Os .Sh NAME .Nm posix_spawnattr_init , .Nm posix_spawnattr_destroy -.Nd "initialize and destroy spawn attributes object" +.Nd "create and destroy posix_spawn attributes object" .Sh SYNOPSIS .In spawn.h .Ft int @@ -47,67 +28,45 @@ .Ft int .Fn posix_spawnattr_destroy "posix_spawnattr_t *attr" .Sh DESCRIPTION -The +posix_spawn attributes objects can be initialized by .Fn posix_spawnattr_init -function initializes a spawn attributes object +and destroyed by +.Fn posix_spawnattr_destroy. +.Pp +Initialization fills an attributes object pointed by .Fa attr -with the default value for all of the individual attributes used by the -implementation. -Initializing an already initialized spawn attributes object may cause -memory to be leaked. +with the default values for all the attributes. +.Pp +Multiple initialization of the same object is undefined behavior +and will lead to memory leaks. .Pp -The +Similarly, objects should be passed to .Fn posix_spawnattr_destroy -function destroys a spawn attributes object. -A destroyed -.Fa attr -attributes object can be reinitialized using +to reclaim memory. +The object should not be re-used after destruction. +It can however be initialized again with .Fn posix_spawnattr_init . -The object should not be used after it has been destroyed. .Pp -A spawn attributes object is of type -.Vt posix_spawnattr_t -(defined in -.In spawn.h ) -and is used to specify the inheritance of process attributes across a -spawn operation. -.Pp -The resulting spawn attributes object (possibly modified by setting -individual attribute values), is used to modify the behavior of +An attributes object, possibly modified by +.Fn posix_spawn_set* , +is used to specify what process attributes +will be passed across a spawn operation as implemented by .Fn posix_spawn or .Fn posix_spawnp . -After a spawn attributes object has been used to spawn a process by a -call to a -.Fn posix_spawn -or -.Fn posix_spawnp , -any function affecting the attributes object (including destruction) -will not affect any process that has been spawned in this way. +.Pp +Modifying or destroying attributes object +will not affect processes that have already been spawned. .Sh RETURN VALUES -Upon successful completion, -.Fn posix_spawnattr_init -and -.Fn posix_spawnattr_destroy -return zero; -otherwise, an error number is returned to indicate the error. -.Sh ERRORS -The -.Fn posix_spawnattr_init -function will fail if: -.Bl -tag -width Er -.It Bq Er ENOMEM -Insufficient memory exists to initialize the spawn file actions object. -.El +These function return 0 on succesful completion. +They may return +.Er ENOMEM +when running out of memory. .Sh SEE ALSO .Xr posix_spawn 3 , .Xr posix_spawnp 3 .Sh STANDARDS -The -.Fn posix_spawnattr_init -and -.Fn posix_spawnattr_destroy -functions conform to +Both functions conform to .St -p1003.1-2001 . .Sh AUTHORS .An Ed Schouten Aq ed@FreeBSD.org |