1 /* Definitions for POSIX spawn interface.
2 Copyright (C) 2000, 2003-2004, 2008-2011 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@
25 /* The include_next requires a split double-inclusion guard. */
27 # @INCLUDE_NEXT@ @NEXT_SPAWN_H@
33 /* Get definitions of 'struct sched_param' and 'sigset_t'.
34 But avoid namespace pollution on glibc systems. */
35 #if !(defined __GLIBC__ && !defined __UCLIBC__)
40 #include <sys/types.h>
46 /* GCC 2.95 and later have "__restrict"; C99 compilers have
47 "restrict", and "configure" may have defined "restrict".
48 Other compilers use __restrict, __restrict__, and _Restrict, and
49 'configure' might #define 'restrict' to those words, so pick a
52 # if 199901L <= __STDC_VERSION__
53 # define _Restrict_ restrict
54 # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
55 # define _Restrict_ __restrict
60 /* gcc 3.1 and up support the [restrict] syntax. Don't trust
61 sys/cdefs.h's definition of __restrict_arr, though, as it
62 mishandles gcc -ansi -pedantic. */
63 #ifndef _Restrict_arr_
64 # if ((199901L <= __STDC_VERSION__ \
65 || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
66 && !__STRICT_ANSI__)) \
68 # define _Restrict_arr_ _Restrict_
70 # define _Restrict_arr_
74 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
76 /* The definition of _GL_ARG_NONNULL is copied here. */
78 /* The definition of _GL_WARN_ON_USE is copied here. */
81 /* Data structure to contain attributes for thread creation. */
82 #if @REPLACE_POSIX_SPAWN@
83 # define posix_spawnattr_t rpl_posix_spawnattr_t
85 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
92 struct sched_param _sp;
99 /* Data structure to contain information about the actions to be
100 performed in the new process with respect to file descriptors. */
101 #if @REPLACE_POSIX_SPAWN@
102 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
104 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
109 struct __spawn_action *_actions;
111 } posix_spawn_file_actions_t;
115 /* Flags to be set in the `posix_spawnattr_t'. */
116 #if @HAVE_POSIX_SPAWN@
117 /* Use the values from the system, but provide the missing ones. */
118 # ifndef POSIX_SPAWN_SETSCHEDPARAM
119 # define POSIX_SPAWN_SETSCHEDPARAM 0
121 # ifndef POSIX_SPAWN_SETSCHEDULER
122 # define POSIX_SPAWN_SETSCHEDULER 0
125 # if @REPLACE_POSIX_SPAWN@
126 /* Use the values from the system, for better compatibility. */
127 /* But this implementation does not support AIX extensions. */
128 # undef POSIX_SPAWN_FORK_HANDLERS
130 # define POSIX_SPAWN_RESETIDS 0x01
131 # define POSIX_SPAWN_SETPGROUP 0x02
132 # define POSIX_SPAWN_SETSIGDEF 0x04
133 # define POSIX_SPAWN_SETSIGMASK 0x08
134 # define POSIX_SPAWN_SETSCHEDPARAM 0x10
135 # define POSIX_SPAWN_SETSCHEDULER 0x20
138 /* A GNU extension. Use the next free bit position. */
139 #define POSIX_SPAWN_USEVFORK \
140 ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \
141 | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \
142 | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \
143 | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1) \
144 | POSIX_SPAWN_SETSCHEDPARAM \
145 | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
146 | POSIX_SPAWN_SETSCHEDULER \
147 | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
149 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
150 [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
151 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
152 | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
153 & POSIX_SPAWN_USEVFORK)
158 #if @GNULIB_POSIX_SPAWN@
159 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
160 Before running the process perform the actions described in FILE-ACTIONS.
162 This function is a possible cancellation points and therefore not
163 marked with __THROW. */
164 # if @REPLACE_POSIX_SPAWN@
165 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
166 # define posix_spawn rpl_posix_spawn
168 _GL_FUNCDECL_RPL (posix_spawn, int,
169 (pid_t *_Restrict_ __pid,
170 const char *_Restrict_ __path,
171 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
172 const posix_spawnattr_t *_Restrict_ __attrp,
173 char *const argv[_Restrict_arr_],
174 char *const envp[_Restrict_arr_])
175 _GL_ARG_NONNULL ((2, 5, 6)));
176 _GL_CXXALIAS_RPL (posix_spawn, int,
177 (pid_t *_Restrict_ __pid,
178 const char *_Restrict_ __path,
179 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
180 const posix_spawnattr_t *_Restrict_ __attrp,
181 char *const argv[_Restrict_arr_],
182 char *const envp[_Restrict_arr_]));
184 # if !@HAVE_POSIX_SPAWN@
185 _GL_FUNCDECL_SYS (posix_spawn, int,
186 (pid_t *_Restrict_ __pid,
187 const char *_Restrict_ __path,
188 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
189 const posix_spawnattr_t *_Restrict_ __attrp,
190 char *const argv[_Restrict_arr_],
191 char *const envp[_Restrict_arr_])
192 _GL_ARG_NONNULL ((2, 5, 6)));
194 _GL_CXXALIAS_SYS (posix_spawn, int,
195 (pid_t *_Restrict_ __pid,
196 const char *_Restrict_ __path,
197 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
198 const posix_spawnattr_t *_Restrict_ __attrp,
199 char *const argv[_Restrict_arr_],
200 char *const envp[_Restrict_arr_]));
202 _GL_CXXALIASWARN (posix_spawn);
203 #elif defined GNULIB_POSIXCHECK
205 # if HAVE_RAW_DECL_POSIX_SPAWN
206 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
207 "use gnulib module posix_spawn for portability");
211 #if @GNULIB_POSIX_SPAWNP@
212 /* Similar to `posix_spawn' but search for FILE in the PATH.
214 This function is a possible cancellation points and therefore not
215 marked with __THROW. */
216 # if @REPLACE_POSIX_SPAWN@
217 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
218 # define posix_spawnp rpl_posix_spawnp
220 _GL_FUNCDECL_RPL (posix_spawnp, int,
221 (pid_t *__pid, const char *__file,
222 const posix_spawn_file_actions_t *__file_actions,
223 const posix_spawnattr_t *__attrp,
224 char *const argv[], char *const envp[])
225 _GL_ARG_NONNULL ((2, 5, 6)));
226 _GL_CXXALIAS_RPL (posix_spawnp, int,
227 (pid_t *__pid, const char *__file,
228 const posix_spawn_file_actions_t *__file_actions,
229 const posix_spawnattr_t *__attrp,
230 char *const argv[], char *const envp[]));
232 # if !@HAVE_POSIX_SPAWN@
233 _GL_FUNCDECL_SYS (posix_spawnp, int,
234 (pid_t *__pid, const char *__file,
235 const posix_spawn_file_actions_t *__file_actions,
236 const posix_spawnattr_t *__attrp,
237 char *const argv[], char *const envp[])
238 _GL_ARG_NONNULL ((2, 5, 6)));
240 _GL_CXXALIAS_SYS (posix_spawnp, int,
241 (pid_t *__pid, const char *__file,
242 const posix_spawn_file_actions_t *__file_actions,
243 const posix_spawnattr_t *__attrp,
244 char *const argv[], char *const envp[]));
246 _GL_CXXALIASWARN (posix_spawnp);
247 #elif defined GNULIB_POSIXCHECK
249 # if HAVE_RAW_DECL_POSIX_SPAWNP
250 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
251 "use gnulib module posix_spawnp for portability");
256 #if @GNULIB_POSIX_SPAWNATTR_INIT@
257 /* Initialize data structure with attributes for `spawn' to default values. */
258 # if @REPLACE_POSIX_SPAWN@
259 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
260 # define posix_spawnattr_init rpl_posix_spawnattr_init
262 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
263 __THROW _GL_ARG_NONNULL ((1)));
264 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
266 # if !@HAVE_POSIX_SPAWN@
267 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
268 __THROW _GL_ARG_NONNULL ((1)));
270 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
272 _GL_CXXALIASWARN (posix_spawnattr_init);
273 #elif defined GNULIB_POSIXCHECK
274 # undef posix_spawnattr_init
275 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
276 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
277 "use gnulib module posix_spawnattr_init for portability");
281 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
282 /* Free resources associated with ATTR. */
283 # if @REPLACE_POSIX_SPAWN@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285 # define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
287 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
288 __THROW _GL_ARG_NONNULL ((1)));
289 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
291 # if !@HAVE_POSIX_SPAWN@
292 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
293 __THROW _GL_ARG_NONNULL ((1)));
295 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
297 _GL_CXXALIASWARN (posix_spawnattr_destroy);
298 #elif defined GNULIB_POSIXCHECK
299 # undef posix_spawnattr_destroy
300 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
301 _GL_WARN_ON_USE (posix_spawnattr_destroy,
302 "posix_spawnattr_destroy is unportable - "
303 "use gnulib module posix_spawnattr_destroy for portability");
307 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
308 /* Store signal mask for signals with default handling from ATTR in
310 # if @REPLACE_POSIX_SPAWN@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
314 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
315 (const posix_spawnattr_t *_Restrict_ __attr,
316 sigset_t *_Restrict_ __sigdefault)
317 __THROW _GL_ARG_NONNULL ((1, 2)));
318 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
319 (const posix_spawnattr_t *_Restrict_ __attr,
320 sigset_t *_Restrict_ __sigdefault));
322 # if !@HAVE_POSIX_SPAWN@
323 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
324 (const posix_spawnattr_t *_Restrict_ __attr,
325 sigset_t *_Restrict_ __sigdefault)
326 __THROW _GL_ARG_NONNULL ((1, 2)));
328 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
329 (const posix_spawnattr_t *_Restrict_ __attr,
330 sigset_t *_Restrict_ __sigdefault));
332 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
333 #elif defined GNULIB_POSIXCHECK
334 # undef posix_spawnattr_getsigdefault
335 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
336 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
337 "posix_spawnattr_getsigdefault is unportable - "
338 "use gnulib module posix_spawnattr_getsigdefault for portability");
342 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
343 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
344 # if @REPLACE_POSIX_SPAWN@
345 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
346 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
348 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
349 (posix_spawnattr_t *_Restrict_ __attr,
350 const sigset_t *_Restrict_ __sigdefault)
351 __THROW _GL_ARG_NONNULL ((1, 2)));
352 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
353 (posix_spawnattr_t *_Restrict_ __attr,
354 const sigset_t *_Restrict_ __sigdefault));
356 # if !@HAVE_POSIX_SPAWN@
357 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
358 (posix_spawnattr_t *_Restrict_ __attr,
359 const sigset_t *_Restrict_ __sigdefault)
360 __THROW _GL_ARG_NONNULL ((1, 2)));
362 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
363 (posix_spawnattr_t *_Restrict_ __attr,
364 const sigset_t *_Restrict_ __sigdefault));
366 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
367 #elif defined GNULIB_POSIXCHECK
368 # undef posix_spawnattr_setsigdefault
369 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
370 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
371 "posix_spawnattr_setsigdefault is unportable - "
372 "use gnulib module posix_spawnattr_setsigdefault for portability");
376 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
377 /* Store signal mask for the new process from ATTR in SIGMASK. */
378 # if @REPLACE_POSIX_SPAWN@
379 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
380 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
382 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
383 (const posix_spawnattr_t *_Restrict_ __attr,
384 sigset_t *_Restrict_ __sigmask)
385 __THROW _GL_ARG_NONNULL ((1, 2)));
386 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
387 (const posix_spawnattr_t *_Restrict_ __attr,
388 sigset_t *_Restrict_ __sigmask));
390 # if !@HAVE_POSIX_SPAWN@
391 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
392 (const posix_spawnattr_t *_Restrict_ __attr,
393 sigset_t *_Restrict_ __sigmask)
394 __THROW _GL_ARG_NONNULL ((1, 2)));
396 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
397 (const posix_spawnattr_t *_Restrict_ __attr,
398 sigset_t *_Restrict_ __sigmask));
400 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
401 #elif defined GNULIB_POSIXCHECK
402 # undef posix_spawnattr_getsigmask
403 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
404 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
405 "posix_spawnattr_getsigmask is unportable - "
406 "use gnulib module posix_spawnattr_getsigmask for portability");
410 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
411 /* Set signal mask for the new process in ATTR to SIGMASK. */
412 # if @REPLACE_POSIX_SPAWN@
413 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
414 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
416 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
417 (posix_spawnattr_t *_Restrict_ __attr,
418 const sigset_t *_Restrict_ __sigmask)
419 __THROW _GL_ARG_NONNULL ((1, 2)));
420 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
421 (posix_spawnattr_t *_Restrict_ __attr,
422 const sigset_t *_Restrict_ __sigmask));
424 # if !@HAVE_POSIX_SPAWN@
425 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
426 (posix_spawnattr_t *_Restrict_ __attr,
427 const sigset_t *_Restrict_ __sigmask)
428 __THROW _GL_ARG_NONNULL ((1, 2)));
430 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
431 (posix_spawnattr_t *_Restrict_ __attr,
432 const sigset_t *_Restrict_ __sigmask));
434 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
435 #elif defined GNULIB_POSIXCHECK
436 # undef posix_spawnattr_setsigmask
437 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
438 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
439 "posix_spawnattr_setsigmask is unportable - "
440 "use gnulib module posix_spawnattr_setsigmask for portability");
444 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
445 /* Get flag word from the attribute structure. */
446 # if @REPLACE_POSIX_SPAWN@
447 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
448 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
450 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
451 (const posix_spawnattr_t *_Restrict_ __attr,
452 short int *_Restrict_ __flags)
453 __THROW _GL_ARG_NONNULL ((1, 2)));
454 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
455 (const posix_spawnattr_t *_Restrict_ __attr,
456 short int *_Restrict_ __flags));
458 # if !@HAVE_POSIX_SPAWN@
459 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
460 (const posix_spawnattr_t *_Restrict_ __attr,
461 short int *_Restrict_ __flags)
462 __THROW _GL_ARG_NONNULL ((1, 2)));
464 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
465 (const posix_spawnattr_t *_Restrict_ __attr,
466 short int *_Restrict_ __flags));
468 _GL_CXXALIASWARN (posix_spawnattr_getflags);
469 #elif defined GNULIB_POSIXCHECK
470 # undef posix_spawnattr_getflags
471 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
472 _GL_WARN_ON_USE (posix_spawnattr_getflags,
473 "posix_spawnattr_getflags is unportable - "
474 "use gnulib module posix_spawnattr_getflags for portability");
478 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
479 /* Store flags in the attribute structure. */
480 # if @REPLACE_POSIX_SPAWN@
481 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
484 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
485 (posix_spawnattr_t *__attr, short int __flags)
486 __THROW _GL_ARG_NONNULL ((1)));
487 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
488 (posix_spawnattr_t *__attr, short int __flags));
490 # if !@HAVE_POSIX_SPAWN@
491 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
492 (posix_spawnattr_t *__attr, short int __flags)
493 __THROW _GL_ARG_NONNULL ((1)));
495 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
496 (posix_spawnattr_t *__attr, short int __flags));
498 _GL_CXXALIASWARN (posix_spawnattr_setflags);
499 #elif defined GNULIB_POSIXCHECK
500 # undef posix_spawnattr_setflags
501 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
502 _GL_WARN_ON_USE (posix_spawnattr_setflags,
503 "posix_spawnattr_setflags is unportable - "
504 "use gnulib module posix_spawnattr_setflags for portability");
508 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
509 /* Get process group ID from the attribute structure. */
510 # if @REPLACE_POSIX_SPAWN@
511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
514 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
515 (const posix_spawnattr_t *_Restrict_ __attr,
516 pid_t *_Restrict_ __pgroup)
517 __THROW _GL_ARG_NONNULL ((1, 2)));
518 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
519 (const posix_spawnattr_t *_Restrict_ __attr,
520 pid_t *_Restrict_ __pgroup));
522 # if !@HAVE_POSIX_SPAWN@
523 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
524 (const posix_spawnattr_t *_Restrict_ __attr,
525 pid_t *_Restrict_ __pgroup)
526 __THROW _GL_ARG_NONNULL ((1, 2)));
528 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
529 (const posix_spawnattr_t *_Restrict_ __attr,
530 pid_t *_Restrict_ __pgroup));
532 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
533 #elif defined GNULIB_POSIXCHECK
534 # undef posix_spawnattr_getpgroup
535 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
536 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
537 "posix_spawnattr_getpgroup is unportable - "
538 "use gnulib module posix_spawnattr_getpgroup for portability");
542 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
543 /* Store process group ID in the attribute structure. */
544 # if @REPLACE_POSIX_SPAWN@
545 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
546 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
548 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
549 (posix_spawnattr_t *__attr, pid_t __pgroup)
550 __THROW _GL_ARG_NONNULL ((1)));
551 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
552 (posix_spawnattr_t *__attr, pid_t __pgroup));
554 # if !@HAVE_POSIX_SPAWN@
555 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
556 (posix_spawnattr_t *__attr, pid_t __pgroup)
557 __THROW _GL_ARG_NONNULL ((1)));
559 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
560 (posix_spawnattr_t *__attr, pid_t __pgroup));
562 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
563 #elif defined GNULIB_POSIXCHECK
564 # undef posix_spawnattr_setpgroup
565 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
566 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
567 "posix_spawnattr_setpgroup is unportable - "
568 "use gnulib module posix_spawnattr_setpgroup for portability");
572 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
573 /* Get scheduling policy from the attribute structure. */
574 # if @REPLACE_POSIX_SPAWN@
575 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
576 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
578 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
579 (const posix_spawnattr_t *_Restrict_ __attr,
580 int *_Restrict_ __schedpolicy)
581 __THROW _GL_ARG_NONNULL ((1, 2)));
582 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
583 (const posix_spawnattr_t *_Restrict_ __attr,
584 int *_Restrict_ __schedpolicy));
586 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
587 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
588 (const posix_spawnattr_t *_Restrict_ __attr,
589 int *_Restrict_ __schedpolicy)
590 __THROW _GL_ARG_NONNULL ((1, 2)));
592 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
593 (const posix_spawnattr_t *_Restrict_ __attr,
594 int *_Restrict_ __schedpolicy));
596 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
597 #elif defined GNULIB_POSIXCHECK
598 # undef posix_spawnattr_getschedpolicy
599 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
600 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
601 "posix_spawnattr_getschedpolicy is unportable - "
602 "use gnulib module posix_spawnattr_getschedpolicy for portability");
606 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
607 /* Store scheduling policy in the attribute structure. */
608 # if @REPLACE_POSIX_SPAWN@
609 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
610 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
612 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
613 (posix_spawnattr_t *__attr, int __schedpolicy)
614 __THROW _GL_ARG_NONNULL ((1)));
615 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
616 (posix_spawnattr_t *__attr, int __schedpolicy));
618 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
619 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
620 (posix_spawnattr_t *__attr, int __schedpolicy)
621 __THROW _GL_ARG_NONNULL ((1)));
623 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
624 (posix_spawnattr_t *__attr, int __schedpolicy));
626 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
627 #elif defined GNULIB_POSIXCHECK
628 # undef posix_spawnattr_setschedpolicy
629 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
630 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
631 "posix_spawnattr_setschedpolicy is unportable - "
632 "use gnulib module posix_spawnattr_setschedpolicy for portability");
636 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
637 /* Get scheduling parameters from the attribute structure. */
638 # if @REPLACE_POSIX_SPAWN@
639 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
640 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
642 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
643 (const posix_spawnattr_t *_Restrict_ __attr,
644 struct sched_param *_Restrict_ __schedparam)
645 __THROW _GL_ARG_NONNULL ((1, 2)));
646 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
647 (const posix_spawnattr_t *_Restrict_ __attr,
648 struct sched_param *_Restrict_ __schedparam));
650 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
651 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
652 (const posix_spawnattr_t *_Restrict_ __attr,
653 struct sched_param *_Restrict_ __schedparam)
654 __THROW _GL_ARG_NONNULL ((1, 2)));
656 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
657 (const posix_spawnattr_t *_Restrict_ __attr,
658 struct sched_param *_Restrict_ __schedparam));
660 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
661 #elif defined GNULIB_POSIXCHECK
662 # undef posix_spawnattr_getschedparam
663 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
664 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
665 "posix_spawnattr_getschedparam is unportable - "
666 "use gnulib module posix_spawnattr_getschedparam for portability");
670 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
671 /* Store scheduling parameters in the attribute structure. */
672 # if @REPLACE_POSIX_SPAWN@
673 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
674 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
676 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
677 (posix_spawnattr_t *_Restrict_ __attr,
678 const struct sched_param *_Restrict_ __schedparam)
679 __THROW _GL_ARG_NONNULL ((1, 2)));
680 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
681 (posix_spawnattr_t *_Restrict_ __attr,
682 const struct sched_param *_Restrict_ __schedparam));
684 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
685 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
686 (posix_spawnattr_t *_Restrict_ __attr,
687 const struct sched_param *_Restrict_ __schedparam)
688 __THROW _GL_ARG_NONNULL ((1, 2)));
690 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
691 (posix_spawnattr_t *_Restrict_ __attr,
692 const struct sched_param *_Restrict_ __schedparam));
694 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
695 #elif defined GNULIB_POSIXCHECK
696 # undef posix_spawnattr_setschedparam
697 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
698 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
699 "posix_spawnattr_setschedparam is unportable - "
700 "use gnulib module posix_spawnattr_setschedparam for portability");
705 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
706 /* Initialize data structure for file attribute for `spawn' call. */
707 # if @REPLACE_POSIX_SPAWN@
708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
709 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
711 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
712 (posix_spawn_file_actions_t *__file_actions)
713 __THROW _GL_ARG_NONNULL ((1)));
714 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
715 (posix_spawn_file_actions_t *__file_actions));
717 # if !@HAVE_POSIX_SPAWN@
718 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
719 (posix_spawn_file_actions_t *__file_actions)
720 __THROW _GL_ARG_NONNULL ((1)));
722 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
723 (posix_spawn_file_actions_t *__file_actions));
725 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
726 #elif defined GNULIB_POSIXCHECK
727 # undef posix_spawn_file_actions_init
728 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
729 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
730 "posix_spawn_file_actions_init is unportable - "
731 "use gnulib module posix_spawn_file_actions_init for portability");
735 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
736 /* Free resources associated with FILE-ACTIONS. */
737 # if @REPLACE_POSIX_SPAWN@
738 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
739 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
741 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
742 (posix_spawn_file_actions_t *__file_actions)
743 __THROW _GL_ARG_NONNULL ((1)));
744 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
745 (posix_spawn_file_actions_t *__file_actions));
747 # if !@HAVE_POSIX_SPAWN@
748 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
749 (posix_spawn_file_actions_t *__file_actions)
750 __THROW _GL_ARG_NONNULL ((1)));
752 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
753 (posix_spawn_file_actions_t *__file_actions));
755 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
756 #elif defined GNULIB_POSIXCHECK
757 # undef posix_spawn_file_actions_destroy
758 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
759 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
760 "posix_spawn_file_actions_destroy is unportable - "
761 "use gnulib module posix_spawn_file_actions_destroy for portability");
765 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
766 /* Add an action to FILE-ACTIONS which tells the implementation to call
767 `open' for the given file during the `spawn' call. */
768 # if @REPLACE_POSIX_SPAWN@
769 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
770 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
772 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
773 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
775 const char *_Restrict_ __path, int __oflag, mode_t __mode)
776 __THROW _GL_ARG_NONNULL ((1, 3)));
777 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
778 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
780 const char *_Restrict_ __path, int __oflag, mode_t __mode));
782 # if !@HAVE_POSIX_SPAWN@
783 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
784 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
786 const char *_Restrict_ __path, int __oflag, mode_t __mode)
787 __THROW _GL_ARG_NONNULL ((1, 3)));
789 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
790 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
792 const char *_Restrict_ __path, int __oflag, mode_t __mode));
794 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
795 #elif defined GNULIB_POSIXCHECK
796 # undef posix_spawn_file_actions_addopen
797 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
798 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
799 "posix_spawn_file_actions_addopen is unportable - "
800 "use gnulib module posix_spawn_file_actions_addopen for portability");
804 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
805 /* Add an action to FILE-ACTIONS which tells the implementation to call
806 `close' for the given file descriptor during the `spawn' call. */
807 # if @REPLACE_POSIX_SPAWN@
808 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
809 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
811 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
812 (posix_spawn_file_actions_t *__file_actions, int __fd)
813 __THROW _GL_ARG_NONNULL ((1)));
814 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
815 (posix_spawn_file_actions_t *__file_actions, int __fd));
817 # if !@HAVE_POSIX_SPAWN@
818 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
819 (posix_spawn_file_actions_t *__file_actions, int __fd)
820 __THROW _GL_ARG_NONNULL ((1)));
822 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
823 (posix_spawn_file_actions_t *__file_actions, int __fd));
825 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
826 #elif defined GNULIB_POSIXCHECK
827 # undef posix_spawn_file_actions_addclose
828 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
829 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
830 "posix_spawn_file_actions_addclose is unportable - "
831 "use gnulib module posix_spawn_file_actions_addclose for portability");
835 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
836 /* Add an action to FILE-ACTIONS which tells the implementation to call
837 `dup2' for the given file descriptors during the `spawn' call. */
838 # if @REPLACE_POSIX_SPAWN@
839 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
840 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
842 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
843 (posix_spawn_file_actions_t *__file_actions,
844 int __fd, int __newfd)
845 __THROW _GL_ARG_NONNULL ((1)));
846 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
847 (posix_spawn_file_actions_t *__file_actions,
848 int __fd, int __newfd));
850 # if !@HAVE_POSIX_SPAWN@
851 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
852 (posix_spawn_file_actions_t *__file_actions,
853 int __fd, int __newfd)
854 __THROW _GL_ARG_NONNULL ((1)));
856 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
857 (posix_spawn_file_actions_t *__file_actions,
858 int __fd, int __newfd));
860 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
861 #elif defined GNULIB_POSIXCHECK
862 # undef posix_spawn_file_actions_adddup2
863 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
864 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
865 "posix_spawn_file_actions_adddup2 is unportable - "
866 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
871 #endif /* _GL_SPAWN_H */
872 #endif /* _GL_SPAWN_H */