]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man3/posix_spawnattr_setflags.3
xnu-1699.22.73.tar.gz
[apple/xnu.git] / bsd / man / man3 / posix_spawnattr_setflags.3
CommitLineData
2d21ac55 1.\"
6d2010ae 2.\" Copyright (c) 2000-2010 Apple Inc. All rights reserved.
2d21ac55
A
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_spawnattr_setflags.3
29.
6d2010ae 30.Dd October 28, 2010
2d21ac55
A
31.Dt POSIX_SPAWNATTR_SETFLAGS 3
32.Os "Mac OS X"
33.Sh NAME
34.Nm posix_spawnattr_setflags
35.Nm posix_spawnattr_getflags
36.Nd get or set flags on a
37.Em posix_spawnattr_t
38.Sh SYNOPSIS
39.Fd #include <spawn.h>
40.Ft int
41.Fo posix_spawnattr_setflags
42.Fa "posix_spawnattr_t *attr"
43.Fa "short flags"
44.Fc
45.Ft int
46.Fo posix_spawnattr_getflags
47.Fa "const posix_spawnattr_t *restrict attr"
48.Fa "short *restrict flags"
49.Fc
50.Sh DESCRIPTION
51The
52.Fn posix_spawnattr_setflags
53function sets the
54.Fa flags
55on the attributes object referenced by
56.Fa attr .
57.Pp
58The
59.Fn posix_spawnattr_getflags
60function retrieves the
61.Fa flags
62on the attributes object referenced by
63.Fa attr .
64.Pp
65The argument
66.Fa flags
67is either 0 or a logical OR of one or more of the following flags:
68.Bl -tag -width POSIX_SPAWN_START_SUSPENDED
69.It Dv POSIX_SPAWN_RESETIDS
b0d623f7
A
70If this bit is set, the child process will inherit the real (rather than the effective) user and
71group ID of the parent process. NOTE: This flag has no effect when the set-group bit is set on the
72process image being spawned.
2d21ac55
A
73.It Dv POSIX_SPAWN_SETPGROUP
74If this bit is not set, then the child process inherits the parent
b0d623f7 75process group; if it is set, then the child process will behave as if the
2d21ac55
A
76.Xr setpgid 2
77function had been called with a
78.Fa pid
79parameter of 0 and a
80.Fa pgid
81parameter equal to the value of the spawn-pgroup value of the
82.Em posix_spawnattr_t ,
83as set by
84.Xr posix_spawnattr_setpgroup 3
85.It Dv POSIX_SPAWN_SETSIGDEF
86Signals set to to either be caught or to the default action in the
87parent process will also be set to the default action in the child
88process. Signals set to be ignored in the parent process will be
89ignored in the child. However, if this bit is set, then signals in
90the
91.Em spawn-sigdefault
92value of the
93.Em posix_spawnattr_t ,
94as set by
95.Xr posix_spawnattr_setsigdefault 3
96which are caught or ignored in the parent will instead be reset to
97their default actions in the child.
98.It Dv POSIX_SPAWN_SETSIGMASK
99If this bit is set, then the initial signal mask of the child process will
100be set to the
101.Em spawn-sigmask
102value of the
103.Em posix_spawnattr_t ,
104as set by
105.Xr posix_spawnattr_setsigmask 3 .
106.It Dv POSIX_SPAWN_SETEXEC
107.Em Apple Extension :
108If this bit is set, rather than returning to the caller,
109.Xr posix_spawn 2
110and
111.Xr posix_spawnp 2
112will behave as a more featureful
113.Xr execve 2 .
114.It Dv POSIX_SPAWN_START_SUSPENDED
115.Em Apple Extension :
116If this bit is set, then the child process will be created with its task
117suspended, permitting debuggers, profilers, and other programs to
118manipulate the process before it begins execution in user space. This
119permits, for example, obtaining exact instruction counts, or debugging
120very early in
121.Xr dyld 1 .
6d2010ae
A
122.It Dv POSIX_SPAWN_CLOEXEC_DEFAULT
123.Em Apple Extension :
124If this bit is set, then only file descriptors explicitly described by the
125.Fa file_actions
126argument are available in the spawned process; all
127of the other file descriptors are
128automatically closed in the spawned process.
2d21ac55
A
129.El
130.Sh RETURN VALUES
131On success, these functions return 0; on failure they return an error
132number from
133.In errno.h .
134The
135.Fn posix_spawnattr_getflags
136additionally, upon successful completion, modifies the value pointed to be the
137.Fa attr
138argument by making it equal to the
139.Em spawn-flags
140attribute of the
141.Em posix_spawnattr_t .
142.Sh ERRORS
143These functions may fail if:
144.Bl -tag -width Er
145.\" ==========
146.It Bq Er EINVAL
147The value specified by
148.Fa attr
149is invalid.
150.\" ==========
151.It Bq Er EINVAL
152The value of
153.Fa attr
154is invalid.
155.El
156.Sh SEE ALSO
157.Xr posix_spawn 2 ,
158.Xr posix_spawnp 2 ,
159.Xr posix_spawnattr_init 3 ,
160.Xr posix_spawnattr_destroy 3 ,
161.Xr posix_spawnattr_setpgroup 3 ,
162.Xr posix_spawnattr_setsigdefault 3 ,
163.Xr posix_spawnattr_setsigmask 3 ,
6d2010ae 164.Xr posix_spawn_file_actions_init 3 ,
2d21ac55
A
165.Xr setpgid 2 ,
166.Xr execve 2 ,
167.Xr dyld 1
168.Sh STANDARDS
169.St -susv3 [SPN]
170.Sh HISTORY
171The
172.Fn posix_spawnattr_setflags
173and
174.Fn posix_spawnattr_getflags
175function calls appeared in
176.St -susv3 [SPN] .