9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / posix_spawn_file_actions_addclose.3c
blob42eb343b573ebe890309f10e25f47555610a851d
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
44 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE 3C "Feb 20, 2009"
47 .SH NAME
48 posix_spawn_file_actions_addclose, posix_spawn_file_actions_addopen \- add
49 close or open action to spawn file actions object
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <spawn.h>
55 \fBint\fR \fBposix_spawn_file_actions_addclose\fR(
56      \fBposix_spawn_file_actions_t *\fR\fIfile_actions\fR, \fBint\fR \fIfildes\fR);
57 .fi
59 .LP
60 .nf
61 \fBint\fR \fBposix_spawn_file_actions_addopen\fR(
62      \fBposix_spawn_file_actions_t *restrict\fR \fIfile_actions\fR, \fBint\fR \fIfildes\fR,
63      \fBconst char *restrict\fR \fIpath\fR, \fBint\fR \fIoflag\fR, \fBmode_t\fR \fImode\fR);
64 .fi
66 .SH DESCRIPTION
67 .sp
68 .LP
69 These functions add or delete a close or open action to a spawn file actions
70 object.
71 .sp
72 .LP
73 A spawn file actions object is of type \fBposix_spawn_file_actions_t\fR
74 (defined in <\fBspawn.h\fR>) and is used to specify a series of actions to be
75 performed by a \fBposix_spawn\fR(3C) or \fBposix_spawn\fR(3C) operation to
76 arrive at the set of open file descriptors for the child process given the set
77 of open file descriptors of the parent.
78 .sp
79 .LP
80 A spawn file actions object, when passed to \fBposix_spawn()\fR or
81 \fBposix_spawnp()\fR, specifies how the set of open file descriptors in the
82 calling process is transformed into a set of potentially open file descriptors
83 for the spawned process. This transformation occurs as though the specified
84 sequence of actions was performed exactly once, in the context of the spawned
85 process (prior to execution of the new process image), in the order in which
86 the actions were added to the object.  Additionally, when the new process image
87 is executed, any file descriptor (from this new set) which has its
88 \fBFD_CLOEXEC\fR flag set is closed (see \fBposix_spawn\fR(3C)).
89 .sp
90 .LP
91 The \fBposix_spawn_file_actions_addclose()\fR function adds a close action to
92 the object referenced by \fIfile_actions\fR that causes the file descriptor
93 fildes to be closed (as if \fBclose\fR(\fIfildes\fR) had been called) when a
94 new process is spawned using this file actions object.
95 .sp
96 .LP
97 The \fBposix_spawn_file_actions_addopen()\fR function adds an open action to
98 the object referenced by \fIfile_actions\fR that causes the file named by path
99 to be opened (as if \fBopen\fR(\fIpath\fR, \fIoflag\fR, \fImode\fR) had been
100 called, and the returned file descriptor, if not \fIfildes\fR, had been changed
101 to \fIfildes\fR) when a new process is spawned using this file actions object.
102 If \fIfildes\fR was already an open file descriptor, it is closed before the
103 new file is opened.
106 The string described by \fIpath\fR is copied by the
107 \fBposix_spawn_file_actions_addopen()\fR function.
108 .SH RETURN VALUES
111 Upon successful completion, these functions return 0. Otherwise, an error
112 number is returned to indicate the error.
113 .SH ERRORS
116 These functions will fail if:
118 .ne 2
120 \fB\fBEBADF\fR\fR
122 .RS 9n
123 The value specified by \fIfildes\fR is negative or greater than or equal to
124 {\fBOPEN_MAX\fR}.
129 These functions may fail if:
131 .ne 2
133 \fB\fBEINVAL\fR\fR
135 .RS 10n
136 The value specified by \fIfile_actions\fR is invalid.
140 .ne 2
142 \fB\fBENOMEM\fR\fR
144 .RS 10n
145 Insufficient memory exists to add to the spawn file actions object.
150 It is not considered an error for the \fIfildes\fR argument passed to these
151 functions to specify a file descriptor for which the specified operation could
152 not be performed at the time of the call. Any such error will be detected when
153 the associated file actions object is later used during a \fBposix_spawn()\fR
154 or \fBposix_spawnp()\fR operation.
157 If a \fBclose\fR(2) operation is specified for a file descriptor that is not
158 open at the time of the call to \fBposix_spawn()\fR or \fBposix_spawnp()\fR,
159 the close operation will not cause the \fBposix_spawn()\fR or
160 \fBposix_spawnp()\fR operation to fail.
161 .SH ATTRIBUTES
164 See \fBattributes\fR(5) for descriptions of the following attributes:
169 box;
170 c | c
171 l | l .
172 ATTRIBUTE TYPE  ATTRIBUTE VALUE
174 Interface Stability     Committed
176 MT-Level        MT-Safe
178 Standard        See \fBstandards\fR(5).
181 .SH SEE ALSO
184 \fBclose\fR(2), \fBdup\fR(2), \fBopen\fR(2), \fBposix_spawn\fR(3C),
185 \fBposix_spawn_file_actions_adddup2\fR(3C),
186 \fBposix_spawn_file_actions_destroy\fR(3C), \fBattributes\fR(5),
187 \fBstandards\fR(5)