Unleashed v1.4
[unleashed.git] / share / man / man3c / posix_spawn_file_actions_adddup2.3c
blob337b421212d48f7dacefcf6ff8ebc1f2d29b2b5d
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) 2004, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 3C "Jan 30, 2004"
47 .SH NAME
48 posix_spawn_file_actions_adddup2 \- add dup2 action to spawn file actions
49 object
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <spawn.h>
55 \fBint\fR \fBposix_spawn_file_actions_adddup2\fR(
56      \fBposix_spawn_file_actions_t *\fR\fIfile_actions\fR, \fBint\fR \fIfildes\fR,
57      \fBint\fR \fInewfildes\fR);
58 .fi
60 .SH DESCRIPTION
61 .sp
62 .LP
63 The \fBposix_spawn_file_actions_adddup2()\fR function adds a \fBdup2\fR(3C)
64 action to the object referenced by \fIfile_actions\fR that causes the file
65 descriptor \fIfildes\fR to be duplicated as \fInewfildes\fR (as if
66 \fBdup2\fR(\fIfildes\fR, \fInewfildes\fR) had been called) when a new process
67 is spawned using this file actions object.
68 .sp
69 .LP
70 A spawn file actions object is as defined in
71 \fBposix_spawn_file_actions_addclose\fR(3C).
72 .SH RETURN VALUES
73 .sp
74 .LP
75 Upon successful completion, the \fBposix_spawn_file_actions_adddup2()\fR
76 function returns 0. Otherwise, an error number is be returned to indicate the
77 error.
78 .SH ERRORS
79 .sp
80 .LP
81 The \fBposix_spawn_file_actions_adddup2()\fR function will fail if:
82 .sp
83 .ne 2
84 .na
85 \fB\fBEBADF\fR\fR
86 .ad
87 .RS 10n
88 The value specified by \fIfildes\fR or \fInewfildes\fR is negative or greater
89 than or equal to {\fBOPEN_MAX\fR}.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fBENOMEM\fR\fR
96 .ad
97 .RS 10n
98 Insufficient memory exists to add to the spawn file actions object.
99 .RE
103 The \fBposix_spawn_file_actions_adddup2()\fR function may fail if:
105 .ne 2
107 \fB\fBEINVAL\fR\fR
109 .RS 10n
110 The value specified by \fIfile_actions\fR is invalid.
115 It is not considered an error for the \fIfildes\fR argument passed to
116 \fBposix_spawn_file_actions_adddup2()\fR to specify a file descriptor for which
117 the specified operation could not be performed at the time of the call. Any
118 such error will be detected when the associated file actions object is later
119 used during a \fBposix_spawn\fR(3C) or \fBposix_spawnp\fR(3C) operation.
120 .SH ATTRIBUTES
123 See \fBattributes\fR(5) for descriptions of the following attributes:
128 box;
129 c | c
130 l | l .
131 ATTRIBUTE TYPE  ATTRIBUTE VALUE
133 Interface Stability     Standard
135 MT-Level        MT-Safe
138 .SH SEE ALSO
141 \fBdup2\fR(3C), \fBposix_spawn\fR(3C),
142 \fBposix_spawn_file_actions_addclose\fR(3C),
143 \fBposix_spawn_file_actions_destroy\fR(3C), \fBattributes\fR(5),
144 \fBstandards\fR(5)