Module Name:    src
Committed By:   christos
Date:           Mon Nov 15 14:01:51 UTC 2021

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/lib/libc/gen: Makefile.inc posix_spawn.3
Added Files:
        src/lib/libc/gen: posix_spawn_file_actions_addchdir.3

Log Message:
Add man pages for posix_spawn_file_actions_add{f,}chdir from piyush


To generate a diff of this commit:
cvs rdiff -u -r1.2397 -r1.2398 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.214 -r1.215 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gen/posix_spawn.3
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/posix_spawn_file_actions_addchdir.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2397 src/distrib/sets/lists/comp/mi:1.2398
--- src/distrib/sets/lists/comp/mi:1.2397	Fri Oct 29 15:12:29 2021
+++ src/distrib/sets/lists/comp/mi	Mon Nov 15 09:01:50 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2397 2021/10/29 19:12:29 macallan Exp $
+#	$NetBSD: mi,v 1.2398 2021/11/15 14:01:50 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp				comp-sys-root
@@ -9287,6 +9287,8 @@
 ./usr/share/man/cat3/posix_spawn_file_actions_addclose.0	comp-c-catman		.cat
 ./usr/share/man/cat3/posix_spawn_file_actions_adddup2.0 comp-c-catman		.cat
 ./usr/share/man/cat3/posix_spawn_file_actions_addopen.0 comp-c-catman		.cat
+./usr/share/man/cat3/posix_spawn_file_actions_addfchdir.0 comp-c-catman		.cat
+./usr/share/man/cat3/posix_spawn_file_actions_addchdir.0 comp-c-catman		.cat
 ./usr/share/man/cat3/posix_spawn_file_actions_destroy.0 comp-c-catman		.cat
 ./usr/share/man/cat3/posix_spawn_file_actions_init.0	comp-c-catman		.cat
 ./usr/share/man/cat3/posix_spawnattr_destroy.0	comp-c-catman		.cat
@@ -17565,6 +17567,8 @@
 ./usr/share/man/html3/posix_spawn_file_actions_addclose.html	comp-c-htmlman		html
 ./usr/share/man/html3/posix_spawn_file_actions_adddup2.html	comp-c-htmlman		html
 ./usr/share/man/html3/posix_spawn_file_actions_addopen.html	comp-c-htmlman		html
+./usr/share/man/html3/posix_spawn_file_actions_addfchdir.html	comp-c-htmlman		html
+./usr/share/man/html3/posix_spawn_file_actions_addchdir.html	comp-c-htmlman		html
 ./usr/share/man/html3/posix_spawn_file_actions_destroy.html	comp-c-htmlman		html
 ./usr/share/man/html3/posix_spawn_file_actions_init.html	comp-c-htmlman		html
 ./usr/share/man/html3/posix_spawnattr_destroy.html	comp-c-htmlman		html
@@ -25833,6 +25837,8 @@
 ./usr/share/man/man3/posix_spawn_file_actions_addclose.3	comp-c-man		.man
 ./usr/share/man/man3/posix_spawn_file_actions_adddup2.3 comp-c-man		.man
 ./usr/share/man/man3/posix_spawn_file_actions_addopen.3 comp-c-man		.man
+./usr/share/man/man3/posix_spawn_file_actions_addfchdir.3 comp-c-man		.man
+./usr/share/man/man3/posix_spawn_file_actions_addchdir.3 comp-c-man		.man
 ./usr/share/man/man3/posix_spawn_file_actions_destroy.3 comp-c-man		.man
 ./usr/share/man/man3/posix_spawn_file_actions_init.3	comp-c-man		.man
 ./usr/share/man/man3/posix_spawnattr_destroy.3	comp-c-man		.man

Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.214 src/lib/libc/gen/Makefile.inc:1.215
--- src/lib/libc/gen/Makefile.inc:1.214	Mon May  3 07:07:55 2021
+++ src/lib/libc/gen/Makefile.inc	Mon Nov 15 09:01:51 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.214 2021/05/03 11:07:55 simonb Exp $
+#	$NetBSD: Makefile.inc,v 1.215 2021/11/15 14:01:51 christos Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -73,6 +73,7 @@ MAN+=	alarm.3 arc4random.3 basename.3 bs
 	nice.3 nlist.3 \
 	pause.3 popen.3 \
 	posix_spawn.3 posix_spawn_file_actions_addopen.3 \
+	posix_spawn_file_actions_addchdir.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_init.3 \
@@ -159,6 +160,7 @@ MLINKS+=popen.3 popenve.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_addchdir.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_getpgroup.3 posix_spawnattr_setpgroup.3 \

Index: src/lib/libc/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.11 src/lib/libc/gen/posix_spawn.3:1.12
--- src/lib/libc/gen/posix_spawn.3:1.11	Wed Jun 12 08:32:54 2019
+++ src/lib/libc/gen/posix_spawn.3	Mon Nov 15 09:01:51 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: posix_spawn.3,v 1.11 2019/06/12 12:32:54 wiz Exp $
+.\" $NetBSD: posix_spawn.3,v 1.12 2021/11/15 14:01:51 christos Exp $
 .\"
 .\" Copyright (c) 2008 Ed Schouten <e...@freebsd.org>
 .\" All rights reserved.
@@ -445,6 +445,8 @@ is returned.
 .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 3 ,
+.Xr posix_spawn_file_actions_addfchdir 3 ,
 .Xr posix_spawn_file_actions_destroy 3 ,
 .Xr posix_spawn_file_actions_init 3 ,
 .Xr posix_spawnattr_destroy 3 ,

Added files:

Index: src/lib/libc/gen/posix_spawn_file_actions_addchdir.3
diff -u /dev/null src/lib/libc/gen/posix_spawn_file_actions_addchdir.3:1.1
--- /dev/null	Mon Nov 15 09:01:51 2021
+++ src/lib/libc/gen/posix_spawn_file_actions_addchdir.3	Mon Nov 15 09:01:51 2021
@@ -0,0 +1,164 @@
+.\" $NetBSD: posix_spawn_file_actions_addchdir.3,v 1.1 2021/11/15 14:01:51 christos 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.
+.\"
+.\" 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 July 8, 2020
+.Dt POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR 3
+.Os
+.Sh NAME
+.Nm posix_spawn_file_actions_addchdir ,
+.Nm posix_spawn_file_actions_addfchdir
+.Nd "add chdir or fchdir action to spawn file actions object"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In spawn.h
+.Ft int
+.Fn posix_spawn_file_actions_addchdir "posix_spawn_file_actions_t *restrict file_actions" "const char *restrict path"
+.Ft int
+.Fn posix_spawn_file_actions_addfchdir "posix_spawn_file_actions_t * file_actions" "int fildes"
+.Sh DESCRIPTION
+The
+.Fn posix_spawn_file_actions_addchdir
+function shall add a chdir action to the object referenced by
+.Fa file_actions
+that shall cause the working directory to be set to
+.Fa path
+(as if
+.Bd -literal -offset indent
+chdir(path)
+.Ed
+.Pp
+had been called) when a new process is spawned usign this file actions
+object.
+A relative
+.Fa path
+shall be interpreted in relation to the working directory determined by any
+prior actions.
+The string pointed to by
+.Fa path
+shall be copied by the
+.Fn posix_spawn_file_actions_addchdir
+function.
+.Pp
+The
+.Fn posix_spawn_file_actions_addfchdir
+function shall add a fchdir action to the object reference by
+.Fa file_actions
+that shall cause the working directory to be set to
+.Fa fildes
+(as if
+.Bd -literal -offset indent
+fchdir(fildes)
+.Ed
+.Pp
+had been called) when a new process is spawned using this file actions object.
+.\" The last paragraph of APPLICATION USAGE
+.Pp
+File actions are performed in the new process created by
+.Fn posix_spawn
+or
+.Fn posix_spawnp
+in the same order that they were added to the file actions object.
+Thus the execution of an "open" action that was created by a call to
+.Fn posix_spawn_file_actions_addopen
+that specifies a relative path will be affected by the execution of a
+chdir or fchdir action that was created by a previous call to
+.Fn posix_spawn_file_actions_addchdir
+or
+.Fn posix_spawn_file_actions_addfchdir
+\&. Likewise, a relaive path passed to
+.Fn posix_spawn
+will be affected by the last chdir or fchdir action in the file action list.
+.Sh RETURN VALUES
+Upon successful completion, these function return zero;
+otherwise, an error number shall be returned to indicate the error.
+.Sh ERRORS
+The
+.Fn posix_spawn_file_actions_addfchdir
+function shall fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The value specified by
+.Fa fildes
+is negative.
+.El
+.Pp
+These functions shall fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory exists to add the spawn file actions object.
+.El
+.Pp
+These functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
+.El
+.Pp
+It shall not be considered an error for the
+.Fa path
+or
+.Fa fildes
+argument passed to these functions to specify a pathanme or file descriptor
+for which the specified operation could not be performed at the time of the call.
+Any such error will be detected when the associated file actions object is
+later used during a
+.Fn posix_spawn
+or
+.Fn posix_spawnp
+operation.
+.Sh SEE ALSO
+.Xr chdir 2 ,
+.Xr fchdir 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_addchdir
+and
+.Fn posix_spawn_file_actions_addfchdir
+functions conform to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The POSIX implementation of
+.Fn posix_spawn_file_actions_addchdir
+and
+.Fn posix_spawn_file_actions_addfchdir
+is derived from SOLARIS kernel's
+.Fn posix_spawn_file_actions_addchdir_np .
+.Sh AUTHORS
+.An Piyush Sachdeva

Reply via email to