]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/man/man3/posix_spawn_file_actions_addclose.3
xnu-1504.15.3.tar.gz
[apple/xnu.git] / bsd / man / man3 / posix_spawn_file_actions_addclose.3
... / ...
CommitLineData
1.\"
2.\" Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3.\"
4.\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5.\"
6.\" This file contains Original Code and/or Modifications of Original Code
7.\" as defined in and that are subject to the Apple Public Source License
8.\" Version 2.0 (the 'License'). You may not use this file except in
9.\" compliance with the License. The rights granted to you under the License
10.\" may not be used to create, or enable the creation or redistribution of,
11.\" unlawful or unlicensed copies of an Apple operating system, or to
12.\" circumvent, violate, or enable the circumvention or violation of, any
13.\" terms of an Apple operating system software license agreement.
14.\"
15.\" Please obtain a copy of the License at
16.\" http://www.opensource.apple.com/apsl/ and read it before using this file.
17.\"
18.\" The Original Code and all software distributed under the License are
19.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23.\" Please see the License for the specific language governing rights and
24.\" limitations under the License.
25.\"
26.\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27.\"
28.\" @(#)posix_spawn_file_actions_addclose.3
29.
30.Dd August 22, 2007
31.Dt POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE 3
32.Os "Mac OS X"
33.Sh NAME
34.Nm posix_spawn_file_actions_addclose
35.Nm posix_spawn_file_actions_addopen
36.Nd add open or close actions to a
37.Em posix_spawn_file_actions_t
38.Sh SYNOPSIS
39.Fd #include <spawn.h>
40.Ft int
41.Fo posix_spawn_file_actions_addclose
42.Fa "posix_spawn_file_actions_t *file_actions"
43.Fa "int filedes"
44.Fc
45.Ft int
46.Fo posix_spawn_file_actions_addopen
47.Fa "posix_spawn_file_actions_t *restrict file_actions"
48.Fa "int filedes"
49.Fa "const char *restrict path"
50.Fa "int oflag"
51.Fa "mode_t mode"
52.Fc
53.Ft int
54.Fo posix_spawn_file_actions_adddup2
55.Fa "posix_spawn_file_actions_t *file_actions"
56.Fa "int filedes"
57.Fa "int newfiledes"
58.Fc
59.Sh DESCRIPTION
60The
61.Fn posix_spawn_file_actions_addclose
62function adds a close operation to the list of operations associated with
63the object referenced by
64.Em file_actions ,
65for subsequent use in a call to
66.Xr posix_spawn 2
67or
68.Xr posix_spawnp 2 .
69The descriptor referred to by
70.Em filedes
71is closed as if
72.Fn close
73had been called on it prior to the new child process
74starting execution.
75.Pp
76The
77.Fn posix_spawn_file_actions_addopen
78function adds an open operation to the list of operations associated with
79the object referenced by
80.Em file_actions ,
81for subsequent use in a call to
82.Xr posix_spawn 2
83or
84.Xr posix_spawnp 2 .
85The descriptor referred to by
86.Em filedes
87is opened using the
88.Em path ,
89.Em oflag ,
90and
91.Em mode
92arguments as if
93.Fn open
94had been called on it prior to the new child process
95starting execution. The string
96.Em path
97is copied by the
98.Fn posix_spawn_file_actions_addopen
99function during this process, so storage need not be persistent in the
100caller.
101.Pp
102The
103.Fn posix_spawn_file_actions_adddup2
104function adds a dup2 operation to the list of operations associated with
105the object referenced by
106.Em file_actions ,
107for subsequent use in a call to
108.Xr posix_spawn 2
109or
110.Xr posix_spawnp 2 .
111The descriptor referred to by
112.Em newfiledes
113is created as if
114.Fn dup2
115had been called on
116.Em filedes
117prior to the new child process starting execution.
118.Sh RETURN VALUES
119On success, these functions return 0; on failure they return an error
120number from
121.In errno.h .
122.Sh ERRORS
123These functions may fail if:
124.Bl -tag -width Er
125.\" ==========
126.It Bq Er EBADF
127The value specified by
128.Fa filedes
129is negative or would cause the process to exceed the maximum number of
130open files it is allowed..
131.\" ==========
132.It Bq Er EINVAL
133The value of
134.Fa file_actions
135is invalid.
136.\" ==========
137.It Bq Er ENOMEM
138Insufficient memory was available eo add to the
139.Fa file_actions .
140.El
141.Sh SEE ALSO
142.Xr posix_spawn 2 ,
143.Xr posix_spawnp 2 ,
144.Xr posix_spawn_file_actions_init 3 ,
145.Xr posix_spawn_file_actions_destroy 3 ,
146.Sh STANDARDS
147.St -susv3 [SPN]
148.Sh HISTORY
149The
150.Fn posix_spawn_file_actions_init
151and
152.Fn posix_spawn_file_actions_destroy
153function calls appeared in
154.St -susv3 [SPN] .