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/>. */
18 #ifndef _@GUARD_PREFIX@_SPAWN_H
21 @PRAGMA_SYSTEM_HEADER@
25 /* The include_next requires a split double-inclusion guard. */
27 # @INCLUDE_NEXT@ @NEXT_SPAWN_H@
30 #ifndef _@GUARD_PREFIX@_SPAWN_H
31 #define _@GUARD_PREFIX@_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@
86 # if !GNULIB_defined_posix_spawnattr_t
93 struct sched_param _sp;
97 # define GNULIB_defined_posix_spawnattr_t 1
102 /* Data structure to contain information about the actions to be
103 performed in the new process with respect to file descriptors. */
104 #if @REPLACE_POSIX_SPAWN@
105 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
107 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
108 # if !GNULIB_defined_posix_spawn_file_actions_t
113 struct __spawn_action *_actions;
115 } posix_spawn_file_actions_t;
116 # define GNULIB_defined_posix_spawn_file_actions_t 1
121 /* Flags to be set in the `posix_spawnattr_t'. */
122 #if @HAVE_POSIX_SPAWN@
123 /* Use the values from the system, but provide the missing ones. */
124 # ifndef POSIX_SPAWN_SETSCHEDPARAM
125 # define POSIX_SPAWN_SETSCHEDPARAM 0
127 # ifndef POSIX_SPAWN_SETSCHEDULER
128 # define POSIX_SPAWN_SETSCHEDULER 0
131 # if @REPLACE_POSIX_SPAWN@
132 /* Use the values from the system, for better compatibility. */
133 /* But this implementation does not support AIX extensions. */
134 # undef POSIX_SPAWN_FORK_HANDLERS
136 # define POSIX_SPAWN_RESETIDS 0x01
137 # define POSIX_SPAWN_SETPGROUP 0x02
138 # define POSIX_SPAWN_SETSIGDEF 0x04
139 # define POSIX_SPAWN_SETSIGMASK 0x08
140 # define POSIX_SPAWN_SETSCHEDPARAM 0x10
141 # define POSIX_SPAWN_SETSCHEDULER 0x20
144 /* A GNU extension. Use the next free bit position. */
145 #define POSIX_SPAWN_USEVFORK \
146 ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \
147 | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \
148 | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \
149 | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1) \
150 | POSIX_SPAWN_SETSCHEDPARAM \
151 | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
152 | POSIX_SPAWN_SETSCHEDULER \
153 | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
155 #if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
156 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
157 [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
158 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
159 | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
160 & POSIX_SPAWN_USEVFORK)
163 # define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1
167 #if @GNULIB_POSIX_SPAWN@
168 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
169 Before running the process perform the actions described in FILE-ACTIONS.
171 This function is a possible cancellation points and therefore not
172 marked with __THROW. */
173 # if @REPLACE_POSIX_SPAWN@
174 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175 # define posix_spawn rpl_posix_spawn
177 _GL_FUNCDECL_RPL (posix_spawn, int,
178 (pid_t *_Restrict_ __pid,
179 const char *_Restrict_ __path,
180 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
181 const posix_spawnattr_t *_Restrict_ __attrp,
182 char *const argv[_Restrict_arr_],
183 char *const envp[_Restrict_arr_])
184 _GL_ARG_NONNULL ((2, 5, 6)));
185 _GL_CXXALIAS_RPL (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_]));
193 # if !@HAVE_POSIX_SPAWN@
194 _GL_FUNCDECL_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_])
201 _GL_ARG_NONNULL ((2, 5, 6)));
203 _GL_CXXALIAS_SYS (posix_spawn, int,
204 (pid_t *_Restrict_ __pid,
205 const char *_Restrict_ __path,
206 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
207 const posix_spawnattr_t *_Restrict_ __attrp,
208 char *const argv[_Restrict_arr_],
209 char *const envp[_Restrict_arr_]));
211 _GL_CXXALIASWARN (posix_spawn);
212 #elif defined GNULIB_POSIXCHECK
214 # if HAVE_RAW_DECL_POSIX_SPAWN
215 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
216 "use gnulib module posix_spawn for portability");
220 #if @GNULIB_POSIX_SPAWNP@
221 /* Similar to `posix_spawn' but search for FILE in the PATH.
223 This function is a possible cancellation points and therefore not
224 marked with __THROW. */
225 # if @REPLACE_POSIX_SPAWN@
226 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
227 # define posix_spawnp rpl_posix_spawnp
229 _GL_FUNCDECL_RPL (posix_spawnp, int,
230 (pid_t *__pid, const char *__file,
231 const posix_spawn_file_actions_t *__file_actions,
232 const posix_spawnattr_t *__attrp,
233 char *const argv[], char *const envp[])
234 _GL_ARG_NONNULL ((2, 5, 6)));
235 _GL_CXXALIAS_RPL (posix_spawnp, int,
236 (pid_t *__pid, const char *__file,
237 const posix_spawn_file_actions_t *__file_actions,
238 const posix_spawnattr_t *__attrp,
239 char *const argv[], char *const envp[]));
241 # if !@HAVE_POSIX_SPAWN@
242 _GL_FUNCDECL_SYS (posix_spawnp, int,
243 (pid_t *__pid, const char *__file,
244 const posix_spawn_file_actions_t *__file_actions,
245 const posix_spawnattr_t *__attrp,
246 char *const argv[], char *const envp[])
247 _GL_ARG_NONNULL ((2, 5, 6)));
249 _GL_CXXALIAS_SYS (posix_spawnp, int,
250 (pid_t *__pid, const char *__file,
251 const posix_spawn_file_actions_t *__file_actions,
252 const posix_spawnattr_t *__attrp,
253 char *const argv[], char *const envp[]));
255 _GL_CXXALIASWARN (posix_spawnp);
256 #elif defined GNULIB_POSIXCHECK
258 # if HAVE_RAW_DECL_POSIX_SPAWNP
259 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
260 "use gnulib module posix_spawnp for portability");
265 #if @GNULIB_POSIX_SPAWNATTR_INIT@
266 /* Initialize data structure with attributes for `spawn' to default values. */
267 # if @REPLACE_POSIX_SPAWN@
268 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
269 # define posix_spawnattr_init rpl_posix_spawnattr_init
271 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
272 __THROW _GL_ARG_NONNULL ((1)));
273 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
275 # if !@HAVE_POSIX_SPAWN@
276 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
277 __THROW _GL_ARG_NONNULL ((1)));
279 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
281 _GL_CXXALIASWARN (posix_spawnattr_init);
282 #elif defined GNULIB_POSIXCHECK
283 # undef posix_spawnattr_init
284 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
285 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
286 "use gnulib module posix_spawnattr_init for portability");
290 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
291 /* Free resources associated with ATTR. */
292 # if @REPLACE_POSIX_SPAWN@
293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
294 # define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
296 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
297 __THROW _GL_ARG_NONNULL ((1)));
298 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
300 # if !@HAVE_POSIX_SPAWN@
301 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
302 __THROW _GL_ARG_NONNULL ((1)));
304 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
306 _GL_CXXALIASWARN (posix_spawnattr_destroy);
307 #elif defined GNULIB_POSIXCHECK
308 # undef posix_spawnattr_destroy
309 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
310 _GL_WARN_ON_USE (posix_spawnattr_destroy,
311 "posix_spawnattr_destroy is unportable - "
312 "use gnulib module posix_spawnattr_destroy for portability");
316 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
317 /* Store signal mask for signals with default handling from ATTR in
319 # if @REPLACE_POSIX_SPAWN@
320 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
321 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
323 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
324 (const posix_spawnattr_t *_Restrict_ __attr,
325 sigset_t *_Restrict_ __sigdefault)
326 __THROW _GL_ARG_NONNULL ((1, 2)));
327 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
328 (const posix_spawnattr_t *_Restrict_ __attr,
329 sigset_t *_Restrict_ __sigdefault));
331 # if !@HAVE_POSIX_SPAWN@
332 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
333 (const posix_spawnattr_t *_Restrict_ __attr,
334 sigset_t *_Restrict_ __sigdefault)
335 __THROW _GL_ARG_NONNULL ((1, 2)));
337 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
338 (const posix_spawnattr_t *_Restrict_ __attr,
339 sigset_t *_Restrict_ __sigdefault));
341 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
342 #elif defined GNULIB_POSIXCHECK
343 # undef posix_spawnattr_getsigdefault
344 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
345 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
346 "posix_spawnattr_getsigdefault is unportable - "
347 "use gnulib module posix_spawnattr_getsigdefault for portability");
351 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
352 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
353 # if @REPLACE_POSIX_SPAWN@
354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
355 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
357 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
358 (posix_spawnattr_t *_Restrict_ __attr,
359 const sigset_t *_Restrict_ __sigdefault)
360 __THROW _GL_ARG_NONNULL ((1, 2)));
361 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
362 (posix_spawnattr_t *_Restrict_ __attr,
363 const sigset_t *_Restrict_ __sigdefault));
365 # if !@HAVE_POSIX_SPAWN@
366 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
367 (posix_spawnattr_t *_Restrict_ __attr,
368 const sigset_t *_Restrict_ __sigdefault)
369 __THROW _GL_ARG_NONNULL ((1, 2)));
371 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
372 (posix_spawnattr_t *_Restrict_ __attr,
373 const sigset_t *_Restrict_ __sigdefault));
375 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
376 #elif defined GNULIB_POSIXCHECK
377 # undef posix_spawnattr_setsigdefault
378 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
379 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
380 "posix_spawnattr_setsigdefault is unportable - "
381 "use gnulib module posix_spawnattr_setsigdefault for portability");
385 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
386 /* Store signal mask for the new process from ATTR in SIGMASK. */
387 # if @REPLACE_POSIX_SPAWN@
388 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
389 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
391 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
392 (const posix_spawnattr_t *_Restrict_ __attr,
393 sigset_t *_Restrict_ __sigmask)
394 __THROW _GL_ARG_NONNULL ((1, 2)));
395 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
396 (const posix_spawnattr_t *_Restrict_ __attr,
397 sigset_t *_Restrict_ __sigmask));
399 # if !@HAVE_POSIX_SPAWN@
400 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
401 (const posix_spawnattr_t *_Restrict_ __attr,
402 sigset_t *_Restrict_ __sigmask)
403 __THROW _GL_ARG_NONNULL ((1, 2)));
405 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
406 (const posix_spawnattr_t *_Restrict_ __attr,
407 sigset_t *_Restrict_ __sigmask));
409 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
410 #elif defined GNULIB_POSIXCHECK
411 # undef posix_spawnattr_getsigmask
412 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
413 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
414 "posix_spawnattr_getsigmask is unportable - "
415 "use gnulib module posix_spawnattr_getsigmask for portability");
419 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
420 /* Set signal mask for the new process in ATTR to SIGMASK. */
421 # if @REPLACE_POSIX_SPAWN@
422 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
423 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
425 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
426 (posix_spawnattr_t *_Restrict_ __attr,
427 const sigset_t *_Restrict_ __sigmask)
428 __THROW _GL_ARG_NONNULL ((1, 2)));
429 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
430 (posix_spawnattr_t *_Restrict_ __attr,
431 const sigset_t *_Restrict_ __sigmask));
433 # if !@HAVE_POSIX_SPAWN@
434 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
435 (posix_spawnattr_t *_Restrict_ __attr,
436 const sigset_t *_Restrict_ __sigmask)
437 __THROW _GL_ARG_NONNULL ((1, 2)));
439 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
440 (posix_spawnattr_t *_Restrict_ __attr,
441 const sigset_t *_Restrict_ __sigmask));
443 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
444 #elif defined GNULIB_POSIXCHECK
445 # undef posix_spawnattr_setsigmask
446 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
447 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
448 "posix_spawnattr_setsigmask is unportable - "
449 "use gnulib module posix_spawnattr_setsigmask for portability");
453 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
454 /* Get flag word from the attribute structure. */
455 # if @REPLACE_POSIX_SPAWN@
456 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
457 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
459 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
460 (const posix_spawnattr_t *_Restrict_ __attr,
461 short int *_Restrict_ __flags)
462 __THROW _GL_ARG_NONNULL ((1, 2)));
463 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
464 (const posix_spawnattr_t *_Restrict_ __attr,
465 short int *_Restrict_ __flags));
467 # if !@HAVE_POSIX_SPAWN@
468 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
469 (const posix_spawnattr_t *_Restrict_ __attr,
470 short int *_Restrict_ __flags)
471 __THROW _GL_ARG_NONNULL ((1, 2)));
473 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
474 (const posix_spawnattr_t *_Restrict_ __attr,
475 short int *_Restrict_ __flags));
477 _GL_CXXALIASWARN (posix_spawnattr_getflags);
478 #elif defined GNULIB_POSIXCHECK
479 # undef posix_spawnattr_getflags
480 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
481 _GL_WARN_ON_USE (posix_spawnattr_getflags,
482 "posix_spawnattr_getflags is unportable - "
483 "use gnulib module posix_spawnattr_getflags for portability");
487 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
488 /* Store flags in the attribute structure. */
489 # if @REPLACE_POSIX_SPAWN@
490 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
491 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
493 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
494 (posix_spawnattr_t *__attr, short int __flags)
495 __THROW _GL_ARG_NONNULL ((1)));
496 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
497 (posix_spawnattr_t *__attr, short int __flags));
499 # if !@HAVE_POSIX_SPAWN@
500 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
501 (posix_spawnattr_t *__attr, short int __flags)
502 __THROW _GL_ARG_NONNULL ((1)));
504 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
505 (posix_spawnattr_t *__attr, short int __flags));
507 _GL_CXXALIASWARN (posix_spawnattr_setflags);
508 #elif defined GNULIB_POSIXCHECK
509 # undef posix_spawnattr_setflags
510 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
511 _GL_WARN_ON_USE (posix_spawnattr_setflags,
512 "posix_spawnattr_setflags is unportable - "
513 "use gnulib module posix_spawnattr_setflags for portability");
517 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
518 /* Get process group ID from the attribute structure. */
519 # if @REPLACE_POSIX_SPAWN@
520 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
521 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
523 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
524 (const posix_spawnattr_t *_Restrict_ __attr,
525 pid_t *_Restrict_ __pgroup)
526 __THROW _GL_ARG_NONNULL ((1, 2)));
527 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
528 (const posix_spawnattr_t *_Restrict_ __attr,
529 pid_t *_Restrict_ __pgroup));
531 # if !@HAVE_POSIX_SPAWN@
532 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
533 (const posix_spawnattr_t *_Restrict_ __attr,
534 pid_t *_Restrict_ __pgroup)
535 __THROW _GL_ARG_NONNULL ((1, 2)));
537 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
538 (const posix_spawnattr_t *_Restrict_ __attr,
539 pid_t *_Restrict_ __pgroup));
541 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
542 #elif defined GNULIB_POSIXCHECK
543 # undef posix_spawnattr_getpgroup
544 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
545 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
546 "posix_spawnattr_getpgroup is unportable - "
547 "use gnulib module posix_spawnattr_getpgroup for portability");
551 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
552 /* Store process group ID in the attribute structure. */
553 # if @REPLACE_POSIX_SPAWN@
554 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
555 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
557 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
558 (posix_spawnattr_t *__attr, pid_t __pgroup)
559 __THROW _GL_ARG_NONNULL ((1)));
560 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
561 (posix_spawnattr_t *__attr, pid_t __pgroup));
563 # if !@HAVE_POSIX_SPAWN@
564 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
565 (posix_spawnattr_t *__attr, pid_t __pgroup)
566 __THROW _GL_ARG_NONNULL ((1)));
568 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
569 (posix_spawnattr_t *__attr, pid_t __pgroup));
571 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
572 #elif defined GNULIB_POSIXCHECK
573 # undef posix_spawnattr_setpgroup
574 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
575 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
576 "posix_spawnattr_setpgroup is unportable - "
577 "use gnulib module posix_spawnattr_setpgroup for portability");
581 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
582 /* Get scheduling policy from the attribute structure. */
583 # if @REPLACE_POSIX_SPAWN@
584 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
585 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
587 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
588 (const posix_spawnattr_t *_Restrict_ __attr,
589 int *_Restrict_ __schedpolicy)
590 __THROW _GL_ARG_NONNULL ((1, 2)));
591 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
592 (const posix_spawnattr_t *_Restrict_ __attr,
593 int *_Restrict_ __schedpolicy));
595 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
596 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
597 (const posix_spawnattr_t *_Restrict_ __attr,
598 int *_Restrict_ __schedpolicy)
599 __THROW _GL_ARG_NONNULL ((1, 2)));
601 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
602 (const posix_spawnattr_t *_Restrict_ __attr,
603 int *_Restrict_ __schedpolicy));
605 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
606 #elif defined GNULIB_POSIXCHECK
607 # undef posix_spawnattr_getschedpolicy
608 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
609 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
610 "posix_spawnattr_getschedpolicy is unportable - "
611 "use gnulib module posix_spawnattr_getschedpolicy for portability");
615 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
616 /* Store scheduling policy in the attribute structure. */
617 # if @REPLACE_POSIX_SPAWN@
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
621 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
622 (posix_spawnattr_t *__attr, int __schedpolicy)
623 __THROW _GL_ARG_NONNULL ((1)));
624 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
625 (posix_spawnattr_t *__attr, int __schedpolicy));
627 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
628 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
629 (posix_spawnattr_t *__attr, int __schedpolicy)
630 __THROW _GL_ARG_NONNULL ((1)));
632 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
633 (posix_spawnattr_t *__attr, int __schedpolicy));
635 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
636 #elif defined GNULIB_POSIXCHECK
637 # undef posix_spawnattr_setschedpolicy
638 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
639 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
640 "posix_spawnattr_setschedpolicy is unportable - "
641 "use gnulib module posix_spawnattr_setschedpolicy for portability");
645 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
646 /* Get scheduling parameters from the attribute structure. */
647 # if @REPLACE_POSIX_SPAWN@
648 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
649 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
651 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
652 (const posix_spawnattr_t *_Restrict_ __attr,
653 struct sched_param *_Restrict_ __schedparam)
654 __THROW _GL_ARG_NONNULL ((1, 2)));
655 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
656 (const posix_spawnattr_t *_Restrict_ __attr,
657 struct sched_param *_Restrict_ __schedparam));
659 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
660 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
661 (const posix_spawnattr_t *_Restrict_ __attr,
662 struct sched_param *_Restrict_ __schedparam)
663 __THROW _GL_ARG_NONNULL ((1, 2)));
665 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
666 (const posix_spawnattr_t *_Restrict_ __attr,
667 struct sched_param *_Restrict_ __schedparam));
669 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
670 #elif defined GNULIB_POSIXCHECK
671 # undef posix_spawnattr_getschedparam
672 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
673 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
674 "posix_spawnattr_getschedparam is unportable - "
675 "use gnulib module posix_spawnattr_getschedparam for portability");
679 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
680 /* Store scheduling parameters in the attribute structure. */
681 # if @REPLACE_POSIX_SPAWN@
682 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
683 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
685 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
686 (posix_spawnattr_t *_Restrict_ __attr,
687 const struct sched_param *_Restrict_ __schedparam)
688 __THROW _GL_ARG_NONNULL ((1, 2)));
689 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
690 (posix_spawnattr_t *_Restrict_ __attr,
691 const struct sched_param *_Restrict_ __schedparam));
693 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
694 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
695 (posix_spawnattr_t *_Restrict_ __attr,
696 const struct sched_param *_Restrict_ __schedparam)
697 __THROW _GL_ARG_NONNULL ((1, 2)));
699 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
700 (posix_spawnattr_t *_Restrict_ __attr,
701 const struct sched_param *_Restrict_ __schedparam));
703 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
704 #elif defined GNULIB_POSIXCHECK
705 # undef posix_spawnattr_setschedparam
706 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
707 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
708 "posix_spawnattr_setschedparam is unportable - "
709 "use gnulib module posix_spawnattr_setschedparam for portability");
714 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
715 /* Initialize data structure for file attribute for `spawn' call. */
716 # if @REPLACE_POSIX_SPAWN@
717 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
720 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
721 (posix_spawn_file_actions_t *__file_actions)
722 __THROW _GL_ARG_NONNULL ((1)));
723 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
724 (posix_spawn_file_actions_t *__file_actions));
726 # if !@HAVE_POSIX_SPAWN@
727 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
728 (posix_spawn_file_actions_t *__file_actions)
729 __THROW _GL_ARG_NONNULL ((1)));
731 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
732 (posix_spawn_file_actions_t *__file_actions));
734 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
735 #elif defined GNULIB_POSIXCHECK
736 # undef posix_spawn_file_actions_init
737 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
738 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
739 "posix_spawn_file_actions_init is unportable - "
740 "use gnulib module posix_spawn_file_actions_init for portability");
744 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
745 /* Free resources associated with FILE-ACTIONS. */
746 # if @REPLACE_POSIX_SPAWN@
747 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
750 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
751 (posix_spawn_file_actions_t *__file_actions)
752 __THROW _GL_ARG_NONNULL ((1)));
753 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
754 (posix_spawn_file_actions_t *__file_actions));
756 # if !@HAVE_POSIX_SPAWN@
757 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
758 (posix_spawn_file_actions_t *__file_actions)
759 __THROW _GL_ARG_NONNULL ((1)));
761 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
762 (posix_spawn_file_actions_t *__file_actions));
764 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
765 #elif defined GNULIB_POSIXCHECK
766 # undef posix_spawn_file_actions_destroy
767 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
768 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
769 "posix_spawn_file_actions_destroy is unportable - "
770 "use gnulib module posix_spawn_file_actions_destroy for portability");
774 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
775 /* Add an action to FILE-ACTIONS which tells the implementation to call
776 `open' for the given file during the `spawn' call. */
777 # if @REPLACE_POSIX_SPAWN@
778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
779 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
781 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
782 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
784 const char *_Restrict_ __path, int __oflag, mode_t __mode)
785 __THROW _GL_ARG_NONNULL ((1, 3)));
786 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
787 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
789 const char *_Restrict_ __path, int __oflag, mode_t __mode));
791 # if !@HAVE_POSIX_SPAWN@
792 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
793 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
795 const char *_Restrict_ __path, int __oflag, mode_t __mode)
796 __THROW _GL_ARG_NONNULL ((1, 3)));
798 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
799 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
801 const char *_Restrict_ __path, int __oflag, mode_t __mode));
803 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
804 #elif defined GNULIB_POSIXCHECK
805 # undef posix_spawn_file_actions_addopen
806 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
807 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
808 "posix_spawn_file_actions_addopen is unportable - "
809 "use gnulib module posix_spawn_file_actions_addopen for portability");
813 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
814 /* Add an action to FILE-ACTIONS which tells the implementation to call
815 `close' for the given file descriptor during the `spawn' call. */
816 # if @REPLACE_POSIX_SPAWN@
817 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
818 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
820 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
821 (posix_spawn_file_actions_t *__file_actions, int __fd)
822 __THROW _GL_ARG_NONNULL ((1)));
823 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
824 (posix_spawn_file_actions_t *__file_actions, int __fd));
826 # if !@HAVE_POSIX_SPAWN@
827 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
828 (posix_spawn_file_actions_t *__file_actions, int __fd)
829 __THROW _GL_ARG_NONNULL ((1)));
831 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
832 (posix_spawn_file_actions_t *__file_actions, int __fd));
834 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
835 #elif defined GNULIB_POSIXCHECK
836 # undef posix_spawn_file_actions_addclose
837 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
838 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
839 "posix_spawn_file_actions_addclose is unportable - "
840 "use gnulib module posix_spawn_file_actions_addclose for portability");
844 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
845 /* Add an action to FILE-ACTIONS which tells the implementation to call
846 `dup2' for the given file descriptors during the `spawn' call. */
847 # if @REPLACE_POSIX_SPAWN@
848 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
849 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
851 _GL_FUNCDECL_RPL (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)));
855 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
856 (posix_spawn_file_actions_t *__file_actions,
857 int __fd, int __newfd));
859 # if !@HAVE_POSIX_SPAWN@
860 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
861 (posix_spawn_file_actions_t *__file_actions,
862 int __fd, int __newfd)
863 __THROW _GL_ARG_NONNULL ((1)));
865 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
866 (posix_spawn_file_actions_t *__file_actions,
867 int __fd, int __newfd));
869 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
870 #elif defined GNULIB_POSIXCHECK
871 # undef posix_spawn_file_actions_adddup2
872 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
873 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
874 "posix_spawn_file_actions_adddup2 is unportable - "
875 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
880 #endif /* _@GUARD_PREFIX@_SPAWN_H */
881 #endif /* _@GUARD_PREFIX@_SPAWN_H */