1 /* Definitions for POSIX spawn interface.
2 Copyright (C) 2000, 2003-2004, 2008-2010 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 @PRAGMA_SYSTEM_HEADER@
24 /* The include_next requires a split double-inclusion guard. */
26 # @INCLUDE_NEXT@ @NEXT_SPAWN_H@
32 /* Get definitions of 'struct sched_param' and 'sigset_t'.
33 But avoid namespace pollution on glibc systems. */
39 #include <sys/types.h>
45 /* GCC 2.95 and later have "__restrict"; C99 compilers have
46 "restrict", and "configure" may have defined "restrict".
47 Other compilers use __restrict, __restrict__, and _Restrict, and
48 'configure' might #define 'restrict' to those words, so pick a
51 # if 199901L <= __STDC_VERSION__
52 # define _Restrict_ restrict
53 # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
54 # define _Restrict_ __restrict
59 /* gcc 3.1 and up support the [restrict] syntax. Don't trust
60 sys/cdefs.h's definition of __restrict_arr, though, as it
61 mishandles gcc -ansi -pedantic. */
62 #ifndef _Restrict_arr_
63 # if ((199901L <= __STDC_VERSION__ \
64 || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
65 && !__STRICT_ANSI__)) \
67 # define _Restrict_arr_ _Restrict_
69 # define _Restrict_arr_
73 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
75 /* The definition of _GL_ARG_NONNULL is copied here. */
77 /* The definition of _GL_WARN_ON_USE is copied here. */
80 /* Data structure to contain attributes for thread creation. */
81 #if @REPLACE_POSIX_SPAWN@
82 # define posix_spawnattr_t rpl_posix_spawnattr_t
84 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
91 struct sched_param _sp;
98 /* Data structure to contain information about the actions to be
99 performed in the new process with respect to file descriptors. */
100 #if @REPLACE_POSIX_SPAWN@
101 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
103 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
108 struct __spawn_action *_actions;
110 } posix_spawn_file_actions_t;
114 /* Flags to be set in the `posix_spawnattr_t'. */
115 #if @HAVE_POSIX_SPAWN@
116 /* Use the values from the system, but provide the missing ones. */
117 # ifndef POSIX_SPAWN_SETSCHEDPARAM
118 # define POSIX_SPAWN_SETSCHEDPARAM 0
120 # ifndef POSIX_SPAWN_SETSCHEDULER
121 # define POSIX_SPAWN_SETSCHEDULER 0
124 # if @REPLACE_POSIX_SPAWN@
125 /* Use the values from the system, for better compatibility. */
126 /* But this implementation does not support AIX extensions. */
127 # undef POSIX_SPAWN_FORK_HANDLERS
129 # define POSIX_SPAWN_RESETIDS 0x01
130 # define POSIX_SPAWN_SETPGROUP 0x02
131 # define POSIX_SPAWN_SETSIGDEF 0x04
132 # define POSIX_SPAWN_SETSIGMASK 0x08
133 # define POSIX_SPAWN_SETSCHEDPARAM 0x10
134 # define POSIX_SPAWN_SETSCHEDULER 0x20
137 /* A GNU extension. Use the next free bit position. */
138 #define POSIX_SPAWN_USEVFORK \
139 ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \
140 | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \
141 | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \
142 | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1) \
143 | POSIX_SPAWN_SETSCHEDPARAM \
144 | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
145 | POSIX_SPAWN_SETSCHEDULER \
146 | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
148 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
149 [2 * (((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
150 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
151 | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
152 & POSIX_SPAWN_USEVFORK) == 0) - 1];
155 #if @GNULIB_POSIX_SPAWN@
156 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
157 Before running the process perform the actions described in FILE-ACTIONS.
159 This function is a possible cancellation points and therefore not
160 marked with __THROW. */
161 # if @REPLACE_POSIX_SPAWN@
162 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
163 # define posix_spawn rpl_posix_spawn
165 _GL_FUNCDECL_RPL (posix_spawn, int,
166 (pid_t *_Restrict_ __pid,
167 const char *_Restrict_ __path,
168 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
169 const posix_spawnattr_t *_Restrict_ __attrp,
170 char *const argv[_Restrict_arr_],
171 char *const envp[_Restrict_arr_])
172 _GL_ARG_NONNULL ((2, 5, 6)));
173 _GL_CXXALIAS_RPL (posix_spawn, int,
174 (pid_t *_Restrict_ __pid,
175 const char *_Restrict_ __path,
176 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
177 const posix_spawnattr_t *_Restrict_ __attrp,
178 char *const argv[_Restrict_arr_],
179 char *const envp[_Restrict_arr_]));
181 # if !@HAVE_POSIX_SPAWN@
182 _GL_FUNCDECL_SYS (posix_spawn, int,
183 (pid_t *_Restrict_ __pid,
184 const char *_Restrict_ __path,
185 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
186 const posix_spawnattr_t *_Restrict_ __attrp,
187 char *const argv[_Restrict_arr_],
188 char *const envp[_Restrict_arr_])
189 _GL_ARG_NONNULL ((2, 5, 6)));
191 _GL_CXXALIAS_SYS (posix_spawn, int,
192 (pid_t *_Restrict_ __pid,
193 const char *_Restrict_ __path,
194 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
195 const posix_spawnattr_t *_Restrict_ __attrp,
196 char *const argv[_Restrict_arr_],
197 char *const envp[_Restrict_arr_]));
199 _GL_CXXALIASWARN (posix_spawn);
200 #elif defined GNULIB_POSIXCHECK
202 # if HAVE_RAW_DECL_POSIX_SPAWN
203 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
204 "use gnulib module posix_spawn for portability");
208 #if @GNULIB_POSIX_SPAWNP@
209 /* Similar to `posix_spawn' but search for FILE in the PATH.
211 This function is a possible cancellation points and therefore not
212 marked with __THROW. */
213 # if @REPLACE_POSIX_SPAWN@
214 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
215 # define posix_spawnp rpl_posix_spawnp
217 _GL_FUNCDECL_RPL (posix_spawnp, int,
218 (pid_t *__pid, const char *__file,
219 const posix_spawn_file_actions_t *__file_actions,
220 const posix_spawnattr_t *__attrp,
221 char *const argv[], char *const envp[])
222 _GL_ARG_NONNULL ((2, 5, 6)));
223 _GL_CXXALIAS_RPL (posix_spawnp, int,
224 (pid_t *__pid, const char *__file,
225 const posix_spawn_file_actions_t *__file_actions,
226 const posix_spawnattr_t *__attrp,
227 char *const argv[], char *const envp[]));
229 # if !@HAVE_POSIX_SPAWN@
230 _GL_FUNCDECL_SYS (posix_spawnp, int,
231 (pid_t *__pid, const char *__file,
232 const posix_spawn_file_actions_t *__file_actions,
233 const posix_spawnattr_t *__attrp,
234 char *const argv[], char *const envp[])
235 _GL_ARG_NONNULL ((2, 5, 6)));
237 _GL_CXXALIAS_SYS (posix_spawnp, int,
238 (pid_t *__pid, const char *__file,
239 const posix_spawn_file_actions_t *__file_actions,
240 const posix_spawnattr_t *__attrp,
241 char *const argv[], char *const envp[]));
243 _GL_CXXALIASWARN (posix_spawnp);
244 #elif defined GNULIB_POSIXCHECK
246 # if HAVE_RAW_DECL_POSIX_SPAWNP
247 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
248 "use gnulib module posix_spawnp for portability");
253 #if @GNULIB_POSIX_SPAWNATTR_INIT@
254 /* Initialize data structure with attributes for `spawn' to default values. */
255 # if @REPLACE_POSIX_SPAWN@
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
257 # define posix_spawnattr_init rpl_posix_spawnattr_init
259 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
260 __THROW _GL_ARG_NONNULL ((1)));
261 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
263 # if !@HAVE_POSIX_SPAWN@
264 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
265 __THROW _GL_ARG_NONNULL ((1)));
267 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
269 _GL_CXXALIASWARN (posix_spawnattr_init);
270 #elif defined GNULIB_POSIXCHECK
271 # undef posix_spawnattr_init
272 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
273 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
274 "use gnulib module posix_spawnattr_init for portability");
278 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
279 /* Free resources associated with ATTR. */
280 # if @REPLACE_POSIX_SPAWN@
281 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
282 # define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
284 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
285 __THROW _GL_ARG_NONNULL ((1)));
286 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
288 # if !@HAVE_POSIX_SPAWN@
289 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
290 __THROW _GL_ARG_NONNULL ((1)));
292 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
294 _GL_CXXALIASWARN (posix_spawnattr_destroy);
295 #elif defined GNULIB_POSIXCHECK
296 # undef posix_spawnattr_destroy
297 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
298 _GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is unportable - "
299 "use gnulib module posix_spawnattr_destroy for portability");
303 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
304 /* Store signal mask for signals with default handling from ATTR in
306 # if @REPLACE_POSIX_SPAWN@
307 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
308 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
310 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
311 (const posix_spawnattr_t *_Restrict_ __attr,
312 sigset_t *_Restrict_ __sigdefault)
313 __THROW _GL_ARG_NONNULL ((1, 2)));
314 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
315 (const posix_spawnattr_t *_Restrict_ __attr,
316 sigset_t *_Restrict_ __sigdefault));
318 # if !@HAVE_POSIX_SPAWN@
319 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
320 (const posix_spawnattr_t *_Restrict_ __attr,
321 sigset_t *_Restrict_ __sigdefault)
322 __THROW _GL_ARG_NONNULL ((1, 2)));
324 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
325 (const posix_spawnattr_t *_Restrict_ __attr,
326 sigset_t *_Restrict_ __sigdefault));
328 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
329 #elif defined GNULIB_POSIXCHECK
330 # undef posix_spawnattr_getsigdefault
331 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
332 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault is unportable - "
333 "use gnulib module posix_spawnattr_getsigdefault for portability");
337 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
338 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
339 # if @REPLACE_POSIX_SPAWN@
340 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
341 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
343 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
344 (posix_spawnattr_t *_Restrict_ __attr,
345 const sigset_t *_Restrict_ __sigdefault)
346 __THROW _GL_ARG_NONNULL ((1, 2)));
347 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
348 (posix_spawnattr_t *_Restrict_ __attr,
349 const sigset_t *_Restrict_ __sigdefault));
351 # if !@HAVE_POSIX_SPAWN@
352 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
353 (posix_spawnattr_t *_Restrict_ __attr,
354 const sigset_t *_Restrict_ __sigdefault)
355 __THROW _GL_ARG_NONNULL ((1, 2)));
357 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
358 (posix_spawnattr_t *_Restrict_ __attr,
359 const sigset_t *_Restrict_ __sigdefault));
361 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
362 #elif defined GNULIB_POSIXCHECK
363 # undef posix_spawnattr_setsigdefault
364 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
365 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault is unportable - "
366 "use gnulib module posix_spawnattr_setsigdefault for portability");
370 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
371 /* Store signal mask for the new process from ATTR in SIGMASK. */
372 # if @REPLACE_POSIX_SPAWN@
373 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
374 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
376 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
377 (const posix_spawnattr_t *_Restrict_ __attr,
378 sigset_t *_Restrict_ __sigmask)
379 __THROW _GL_ARG_NONNULL ((1, 2)));
380 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
381 (const posix_spawnattr_t *_Restrict_ __attr,
382 sigset_t *_Restrict_ __sigmask));
384 # if !@HAVE_POSIX_SPAWN@
385 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
386 (const posix_spawnattr_t *_Restrict_ __attr,
387 sigset_t *_Restrict_ __sigmask)
388 __THROW _GL_ARG_NONNULL ((1, 2)));
390 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
391 (const posix_spawnattr_t *_Restrict_ __attr,
392 sigset_t *_Restrict_ __sigmask));
394 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
395 #elif defined GNULIB_POSIXCHECK
396 # undef posix_spawnattr_getsigmask
397 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
398 _GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is unportable - "
399 "use gnulib module posix_spawnattr_getsigmask for portability");
403 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
404 /* Set signal mask for the new process in ATTR to SIGMASK. */
405 # if @REPLACE_POSIX_SPAWN@
406 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
407 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
409 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
410 (posix_spawnattr_t *_Restrict_ __attr,
411 const sigset_t *_Restrict_ __sigmask)
412 __THROW _GL_ARG_NONNULL ((1, 2)));
413 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
414 (posix_spawnattr_t *_Restrict_ __attr,
415 const sigset_t *_Restrict_ __sigmask));
417 # if !@HAVE_POSIX_SPAWN@
418 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
419 (posix_spawnattr_t *_Restrict_ __attr,
420 const sigset_t *_Restrict_ __sigmask)
421 __THROW _GL_ARG_NONNULL ((1, 2)));
423 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
424 (posix_spawnattr_t *_Restrict_ __attr,
425 const sigset_t *_Restrict_ __sigmask));
427 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
428 #elif defined GNULIB_POSIXCHECK
429 # undef posix_spawnattr_setsigmask
430 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
431 _GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is unportable - "
432 "use gnulib module posix_spawnattr_setsigmask for portability");
436 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
437 /* Get flag word from the attribute structure. */
438 # if @REPLACE_POSIX_SPAWN@
439 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
440 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
442 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
443 (const posix_spawnattr_t *_Restrict_ __attr,
444 short int *_Restrict_ __flags)
445 __THROW _GL_ARG_NONNULL ((1, 2)));
446 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
447 (const posix_spawnattr_t *_Restrict_ __attr,
448 short int *_Restrict_ __flags));
450 # if !@HAVE_POSIX_SPAWN@
451 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
452 (const posix_spawnattr_t *_Restrict_ __attr,
453 short int *_Restrict_ __flags)
454 __THROW _GL_ARG_NONNULL ((1, 2)));
456 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
457 (const posix_spawnattr_t *_Restrict_ __attr,
458 short int *_Restrict_ __flags));
460 _GL_CXXALIASWARN (posix_spawnattr_getflags);
461 #elif defined GNULIB_POSIXCHECK
462 # undef posix_spawnattr_getflags
463 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
464 _GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is unportable - "
465 "use gnulib module posix_spawnattr_getflags for portability");
469 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
470 /* Store flags in the attribute structure. */
471 # if @REPLACE_POSIX_SPAWN@
472 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
473 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
475 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
476 (posix_spawnattr_t *__attr, short int __flags)
477 __THROW _GL_ARG_NONNULL ((1)));
478 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
479 (posix_spawnattr_t *__attr, short int __flags));
481 # if !@HAVE_POSIX_SPAWN@
482 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
483 (posix_spawnattr_t *__attr, short int __flags)
484 __THROW _GL_ARG_NONNULL ((1)));
486 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
487 (posix_spawnattr_t *__attr, short int __flags));
489 _GL_CXXALIASWARN (posix_spawnattr_setflags);
490 #elif defined GNULIB_POSIXCHECK
491 # undef posix_spawnattr_setflags
492 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
493 _GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is unportable - "
494 "use gnulib module posix_spawnattr_setflags for portability");
498 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
499 /* Get process group ID from the attribute structure. */
500 # if @REPLACE_POSIX_SPAWN@
501 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
502 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
504 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
505 (const posix_spawnattr_t *_Restrict_ __attr,
506 pid_t *_Restrict_ __pgroup)
507 __THROW _GL_ARG_NONNULL ((1, 2)));
508 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
509 (const posix_spawnattr_t *_Restrict_ __attr,
510 pid_t *_Restrict_ __pgroup));
512 # if !@HAVE_POSIX_SPAWN@
513 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
514 (const posix_spawnattr_t *_Restrict_ __attr,
515 pid_t *_Restrict_ __pgroup)
516 __THROW _GL_ARG_NONNULL ((1, 2)));
518 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
519 (const posix_spawnattr_t *_Restrict_ __attr,
520 pid_t *_Restrict_ __pgroup));
522 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
523 #elif defined GNULIB_POSIXCHECK
524 # undef posix_spawnattr_getpgroup
525 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
526 _GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is unportable - "
527 "use gnulib module posix_spawnattr_getpgroup for portability");
531 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
532 /* Store process group ID in the attribute structure. */
533 # if @REPLACE_POSIX_SPAWN@
534 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
535 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
537 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
538 (posix_spawnattr_t *__attr, pid_t __pgroup)
539 __THROW _GL_ARG_NONNULL ((1)));
540 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
541 (posix_spawnattr_t *__attr, pid_t __pgroup));
543 # if !@HAVE_POSIX_SPAWN@
544 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
545 (posix_spawnattr_t *__attr, pid_t __pgroup)
546 __THROW _GL_ARG_NONNULL ((1)));
548 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
549 (posix_spawnattr_t *__attr, pid_t __pgroup));
551 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
552 #elif defined GNULIB_POSIXCHECK
553 # undef posix_spawnattr_setpgroup
554 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
555 _GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is unportable - "
556 "use gnulib module posix_spawnattr_setpgroup for portability");
560 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
561 /* Get scheduling policy from the attribute structure. */
562 # if @REPLACE_POSIX_SPAWN@
563 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
564 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
566 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
567 (const posix_spawnattr_t *_Restrict_ __attr,
568 int *_Restrict_ __schedpolicy)
569 __THROW _GL_ARG_NONNULL ((1, 2)));
570 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
571 (const posix_spawnattr_t *_Restrict_ __attr,
572 int *_Restrict_ __schedpolicy));
574 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
575 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
576 (const posix_spawnattr_t *_Restrict_ __attr,
577 int *_Restrict_ __schedpolicy)
578 __THROW _GL_ARG_NONNULL ((1, 2)));
580 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
581 (const posix_spawnattr_t *_Restrict_ __attr,
582 int *_Restrict_ __schedpolicy));
584 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
585 #elif defined GNULIB_POSIXCHECK
586 # undef posix_spawnattr_getschedpolicy
587 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
588 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, "posix_spawnattr_getschedpolicy is unportable - "
589 "use gnulib module posix_spawnattr_getschedpolicy for portability");
593 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
594 /* Store scheduling policy in the attribute structure. */
595 # if @REPLACE_POSIX_SPAWN@
596 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
597 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
599 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
600 (posix_spawnattr_t *__attr, int __schedpolicy)
601 __THROW _GL_ARG_NONNULL ((1)));
602 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
603 (posix_spawnattr_t *__attr, int __schedpolicy));
605 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
606 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
607 (posix_spawnattr_t *__attr, int __schedpolicy)
608 __THROW _GL_ARG_NONNULL ((1)));
610 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
611 (posix_spawnattr_t *__attr, int __schedpolicy));
613 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
614 #elif defined GNULIB_POSIXCHECK
615 # undef posix_spawnattr_setschedpolicy
616 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
617 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, "posix_spawnattr_setschedpolicy is unportable - "
618 "use gnulib module posix_spawnattr_setschedpolicy for portability");
622 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
623 /* Get scheduling parameters from the attribute structure. */
624 # if @REPLACE_POSIX_SPAWN@
625 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
628 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
629 (const posix_spawnattr_t *_Restrict_ __attr,
630 struct sched_param *_Restrict_ __schedparam)
631 __THROW _GL_ARG_NONNULL ((1, 2)));
632 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
633 (const posix_spawnattr_t *_Restrict_ __attr,
634 struct sched_param *_Restrict_ __schedparam));
636 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
637 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
638 (const posix_spawnattr_t *_Restrict_ __attr,
639 struct sched_param *_Restrict_ __schedparam)
640 __THROW _GL_ARG_NONNULL ((1, 2)));
642 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
643 (const posix_spawnattr_t *_Restrict_ __attr,
644 struct sched_param *_Restrict_ __schedparam));
646 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
647 #elif defined GNULIB_POSIXCHECK
648 # undef posix_spawnattr_getschedparam
649 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
650 _GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam is unportable - "
651 "use gnulib module posix_spawnattr_getschedparam for portability");
655 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
656 /* Store scheduling parameters in the attribute structure. */
657 # if @REPLACE_POSIX_SPAWN@
658 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
659 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
661 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
662 (posix_spawnattr_t *_Restrict_ __attr,
663 const struct sched_param *_Restrict_ __schedparam)
664 __THROW _GL_ARG_NONNULL ((1, 2)));
665 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
666 (posix_spawnattr_t *_Restrict_ __attr,
667 const struct sched_param *_Restrict_ __schedparam));
669 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
670 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
671 (posix_spawnattr_t *_Restrict_ __attr,
672 const struct sched_param *_Restrict_ __schedparam)
673 __THROW _GL_ARG_NONNULL ((1, 2)));
675 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
676 (posix_spawnattr_t *_Restrict_ __attr,
677 const struct sched_param *_Restrict_ __schedparam));
679 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
680 #elif defined GNULIB_POSIXCHECK
681 # undef posix_spawnattr_setschedparam
682 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
683 _GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam is unportable - "
684 "use gnulib module posix_spawnattr_setschedparam for portability");
689 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
690 /* Initialize data structure for file attribute for `spawn' call. */
691 # if @REPLACE_POSIX_SPAWN@
692 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
693 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
695 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
696 (posix_spawn_file_actions_t *__file_actions)
697 __THROW _GL_ARG_NONNULL ((1)));
698 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
699 (posix_spawn_file_actions_t *__file_actions));
701 # if !@HAVE_POSIX_SPAWN@
702 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
703 (posix_spawn_file_actions_t *__file_actions)
704 __THROW _GL_ARG_NONNULL ((1)));
706 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
707 (posix_spawn_file_actions_t *__file_actions));
709 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
710 #elif defined GNULIB_POSIXCHECK
711 # undef posix_spawn_file_actions_init
712 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
713 _GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init is unportable - "
714 "use gnulib module posix_spawn_file_actions_init for portability");
718 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
719 /* Free resources associated with FILE-ACTIONS. */
720 # if @REPLACE_POSIX_SPAWN@
721 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
724 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
725 (posix_spawn_file_actions_t *__file_actions)
726 __THROW _GL_ARG_NONNULL ((1)));
727 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
728 (posix_spawn_file_actions_t *__file_actions));
730 # if !@HAVE_POSIX_SPAWN@
731 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
732 (posix_spawn_file_actions_t *__file_actions)
733 __THROW _GL_ARG_NONNULL ((1)));
735 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
736 (posix_spawn_file_actions_t *__file_actions));
738 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
739 #elif defined GNULIB_POSIXCHECK
740 # undef posix_spawn_file_actions_destroy
741 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
742 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy, "posix_spawn_file_actions_destroy is unportable - "
743 "use gnulib module posix_spawn_file_actions_destroy for portability");
747 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
748 /* Add an action to FILE-ACTIONS which tells the implementation to call
749 `open' for the given file during the `spawn' call. */
750 # if @REPLACE_POSIX_SPAWN@
751 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
752 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
754 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
755 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
757 const char *_Restrict_ __path, int __oflag, mode_t __mode)
758 __THROW _GL_ARG_NONNULL ((1, 3)));
759 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
760 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
762 const char *_Restrict_ __path, int __oflag, mode_t __mode));
764 # if !@HAVE_POSIX_SPAWN@
765 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
766 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
768 const char *_Restrict_ __path, int __oflag, mode_t __mode)
769 __THROW _GL_ARG_NONNULL ((1, 3)));
771 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
772 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
774 const char *_Restrict_ __path, int __oflag, mode_t __mode));
776 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
777 #elif defined GNULIB_POSIXCHECK
778 # undef posix_spawn_file_actions_addopen
779 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
780 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen, "posix_spawn_file_actions_addopen is unportable - "
781 "use gnulib module posix_spawn_file_actions_addopen for portability");
785 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
786 /* Add an action to FILE-ACTIONS which tells the implementation to call
787 `close' for the given file descriptor during the `spawn' call. */
788 # if @REPLACE_POSIX_SPAWN@
789 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
790 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
792 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
793 (posix_spawn_file_actions_t *__file_actions, int __fd)
794 __THROW _GL_ARG_NONNULL ((1)));
795 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
796 (posix_spawn_file_actions_t *__file_actions, int __fd));
798 # if !@HAVE_POSIX_SPAWN@
799 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
800 (posix_spawn_file_actions_t *__file_actions, int __fd)
801 __THROW _GL_ARG_NONNULL ((1)));
803 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
804 (posix_spawn_file_actions_t *__file_actions, int __fd));
806 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
807 #elif defined GNULIB_POSIXCHECK
808 # undef posix_spawn_file_actions_addclose
809 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
810 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose, "posix_spawn_file_actions_addclose is unportable - "
811 "use gnulib module posix_spawn_file_actions_addclose for portability");
815 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
816 /* Add an action to FILE-ACTIONS which tells the implementation to call
817 `dup2' for the given file descriptors during the `spawn' call. */
818 # if @REPLACE_POSIX_SPAWN@
819 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
820 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
822 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
823 (posix_spawn_file_actions_t *__file_actions,
824 int __fd, int __newfd)
825 __THROW _GL_ARG_NONNULL ((1)));
826 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
827 (posix_spawn_file_actions_t *__file_actions,
828 int __fd, int __newfd));
830 # if !@HAVE_POSIX_SPAWN@
831 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
832 (posix_spawn_file_actions_t *__file_actions,
833 int __fd, int __newfd)
834 __THROW _GL_ARG_NONNULL ((1)));
836 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
837 (posix_spawn_file_actions_t *__file_actions,
838 int __fd, int __newfd));
840 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
841 #elif defined GNULIB_POSIXCHECK
842 # undef posix_spawn_file_actions_adddup2
843 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
844 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, "posix_spawn_file_actions_adddup2 is unportable - "
845 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
850 #endif /* _GL_SPAWN_H */
851 #endif /* _GL_SPAWN_H */