1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SPAWN_H
#define _SPAWN_H
#include <sys/feature_tests.h>
#include <sys/types.h>
#include <signal.h>
#include <sched.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* flags for posix_spawnattr_setflags()
*/
#define POSIX_SPAWN_RESETIDS 0x0001
#define POSIX_SPAWN_SETPGROUP 0x0002
#define POSIX_SPAWN_SETSIGDEF 0x0004
#define POSIX_SPAWN_SETSIGMASK 0x0008
#define POSIX_SPAWN_SETSCHEDPARAM 0x0010
#define POSIX_SPAWN_SETSCHEDULER 0x0020
/*
* non-portable Solaris extensions
*/
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#define POSIX_SPAWN_SETSIGIGN_NP 0x0800
#define POSIX_SPAWN_NOSIGCHLD_NP 0x1000
#define POSIX_SPAWN_WAITPID_NP 0x2000
#define POSIX_SPAWN_NOEXECERR_NP 0x4000
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
typedef struct {
void *__spawn_attrp; /* implementation-private */
} posix_spawnattr_t;
typedef struct {
void *__file_attrp; /* implementation-private */
} posix_spawn_file_actions_t;
#if defined(__STDC__)
extern int posix_spawn(
pid_t *_RESTRICT_KYWD pid,
const char *_RESTRICT_KYWD path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *_RESTRICT_KYWD attrp,
char *const argv[_RESTRICT_KYWD],
char *const envp[_RESTRICT_KYWD]);
extern int posix_spawnp(
pid_t *_RESTRICT_KYWD pid,
const char *_RESTRICT_KYWD file,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *_RESTRICT_KYWD attrp,
char *const argv[_RESTRICT_KYWD],
char *const envp[_RESTRICT_KYWD]);
extern int posix_spawn_file_actions_init(
posix_spawn_file_actions_t *file_actions);
extern int posix_spawn_file_actions_destroy(
posix_spawn_file_actions_t *file_actions);
extern int posix_spawn_file_actions_addopen(
posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions,
int filedes,
const char *_RESTRICT_KYWD path,
int oflag,
mode_t mode);
extern int posix_spawn_file_actions_addclose(
posix_spawn_file_actions_t *file_actions,
int filedes);
extern int posix_spawn_file_actions_adddup2(
posix_spawn_file_actions_t *file_actions,
int filedes,
int newfiledes);
extern int posix_spawnattr_init(
posix_spawnattr_t *attr);
extern int posix_spawnattr_destroy(
posix_spawnattr_t *attr);
extern int posix_spawnattr_setflags(
posix_spawnattr_t *attr,
short flags);
extern int posix_spawnattr_getflags(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
short *_RESTRICT_KYWD flags);
extern int posix_spawnattr_setpgroup(
posix_spawnattr_t *attr,
pid_t pgroup);
extern int posix_spawnattr_getpgroup(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
pid_t *_RESTRICT_KYWD pgroup);
extern int posix_spawnattr_setschedparam(
posix_spawnattr_t *_RESTRICT_KYWD attr,
const struct sched_param *_RESTRICT_KYWD schedparam);
extern int posix_spawnattr_getschedparam(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
struct sched_param *_RESTRICT_KYWD schedparam);
extern int posix_spawnattr_setschedpolicy(
posix_spawnattr_t *attr,
int schedpolicy);
extern int posix_spawnattr_getschedpolicy(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
int *_RESTRICT_KYWD schedpolicy);
extern int posix_spawnattr_setsigdefault(
posix_spawnattr_t *_RESTRICT_KYWD attr,
const sigset_t *_RESTRICT_KYWD sigdefault);
extern int posix_spawnattr_getsigdefault(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
sigset_t *_RESTRICT_KYWD sigdefault);
/*
* non-portable Solaris extensions
*/
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
extern int posix_spawn_file_actions_addclosefrom_np(
posix_spawn_file_actions_t *file_actions,
int lowfiledes);
extern int posix_spawnattr_setsigignore_np(
posix_spawnattr_t *_RESTRICT_KYWD attr,
const sigset_t *_RESTRICT_KYWD sigignore);
extern int posix_spawnattr_getsigignore_np(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
sigset_t *_RESTRICT_KYWD sigignore);
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
extern int posix_spawnattr_setsigmask(
posix_spawnattr_t *_RESTRICT_KYWD attr,
const sigset_t *_RESTRICT_KYWD sigmask);
extern int posix_spawnattr_getsigmask(
const posix_spawnattr_t *_RESTRICT_KYWD attr,
sigset_t *_RESTRICT_KYWD sigmask);
#else /* __STDC__ */
extern int posix_spawn();
extern int posix_spawnp();
extern int posix_spawn_file_actions_init();
extern int posix_spawn_file_actions_destroy();
extern int posix_spawn_file_actions_addopen();
extern int posix_spawn_file_actions_addclose();
extern int posix_spawn_file_actions_adddup2();
extern int posix_spawnattr_init();
extern int posix_spawnattr_destroy();
extern int posix_spawnattr_setflags();
extern int posix_spawnattr_getflags();
extern int posix_spawnattr_setpgroup();
extern int posix_spawnattr_getpgroup();
extern int posix_spawnattr_setschedparam();
extern int posix_spawnattr_getschedparam();
extern int posix_spawnattr_setschedpolicy();
extern int posix_spawnattr_getschedpolicy();
extern int posix_spawnattr_setsigdefault();
extern int posix_spawnattr_getsigdefault();
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
extern int posix_spawn_file_actions_addclosefrom_np();
extern int posix_spawnattr_setsigignore_np();
extern int posix_spawnattr_getsigignore_np();
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
extern int posix_spawnattr_setsigmask();
extern int posix_spawnattr_getsigmask();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _SPAWN_H */
|