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,
299 "posix_spawnattr_destroy is unportable - "
300 "use gnulib module posix_spawnattr_destroy for portability");
304 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
305 /* Store signal mask for signals with default handling from ATTR in
307 # if @REPLACE_POSIX_SPAWN@
308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
309 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
311 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
312 (const posix_spawnattr_t *_Restrict_ __attr,
313 sigset_t *_Restrict_ __sigdefault)
314 __THROW _GL_ARG_NONNULL ((1, 2)));
315 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
316 (const posix_spawnattr_t *_Restrict_ __attr,
317 sigset_t *_Restrict_ __sigdefault));
319 # if !@HAVE_POSIX_SPAWN@
320 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
321 (const posix_spawnattr_t *_Restrict_ __attr,
322 sigset_t *_Restrict_ __sigdefault)
323 __THROW _GL_ARG_NONNULL ((1, 2)));
325 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
326 (const posix_spawnattr_t *_Restrict_ __attr,
327 sigset_t *_Restrict_ __sigdefault));
329 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
330 #elif defined GNULIB_POSIXCHECK
331 # undef posix_spawnattr_getsigdefault
332 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
333 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
334 "posix_spawnattr_getsigdefault is unportable - "
335 "use gnulib module posix_spawnattr_getsigdefault for portability");
339 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
340 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
341 # if @REPLACE_POSIX_SPAWN@
342 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
343 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
345 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
346 (posix_spawnattr_t *_Restrict_ __attr,
347 const sigset_t *_Restrict_ __sigdefault)
348 __THROW _GL_ARG_NONNULL ((1, 2)));
349 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
350 (posix_spawnattr_t *_Restrict_ __attr,
351 const sigset_t *_Restrict_ __sigdefault));
353 # if !@HAVE_POSIX_SPAWN@
354 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
355 (posix_spawnattr_t *_Restrict_ __attr,
356 const sigset_t *_Restrict_ __sigdefault)
357 __THROW _GL_ARG_NONNULL ((1, 2)));
359 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
360 (posix_spawnattr_t *_Restrict_ __attr,
361 const sigset_t *_Restrict_ __sigdefault));
363 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
364 #elif defined GNULIB_POSIXCHECK
365 # undef posix_spawnattr_setsigdefault
366 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
367 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
368 "posix_spawnattr_setsigdefault is unportable - "
369 "use gnulib module posix_spawnattr_setsigdefault for portability");
373 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
374 /* Store signal mask for the new process from ATTR in SIGMASK. */
375 # if @REPLACE_POSIX_SPAWN@
376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
377 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
379 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
380 (const posix_spawnattr_t *_Restrict_ __attr,
381 sigset_t *_Restrict_ __sigmask)
382 __THROW _GL_ARG_NONNULL ((1, 2)));
383 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
384 (const posix_spawnattr_t *_Restrict_ __attr,
385 sigset_t *_Restrict_ __sigmask));
387 # if !@HAVE_POSIX_SPAWN@
388 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
389 (const posix_spawnattr_t *_Restrict_ __attr,
390 sigset_t *_Restrict_ __sigmask)
391 __THROW _GL_ARG_NONNULL ((1, 2)));
393 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
394 (const posix_spawnattr_t *_Restrict_ __attr,
395 sigset_t *_Restrict_ __sigmask));
397 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
398 #elif defined GNULIB_POSIXCHECK
399 # undef posix_spawnattr_getsigmask
400 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
401 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
402 "posix_spawnattr_getsigmask is unportable - "
403 "use gnulib module posix_spawnattr_getsigmask for portability");
407 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
408 /* Set signal mask for the new process in ATTR to SIGMASK. */
409 # if @REPLACE_POSIX_SPAWN@
410 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
411 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
413 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
414 (posix_spawnattr_t *_Restrict_ __attr,
415 const sigset_t *_Restrict_ __sigmask)
416 __THROW _GL_ARG_NONNULL ((1, 2)));
417 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
418 (posix_spawnattr_t *_Restrict_ __attr,
419 const sigset_t *_Restrict_ __sigmask));
421 # if !@HAVE_POSIX_SPAWN@
422 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
423 (posix_spawnattr_t *_Restrict_ __attr,
424 const sigset_t *_Restrict_ __sigmask)
425 __THROW _GL_ARG_NONNULL ((1, 2)));
427 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
428 (posix_spawnattr_t *_Restrict_ __attr,
429 const sigset_t *_Restrict_ __sigmask));
431 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
432 #elif defined GNULIB_POSIXCHECK
433 # undef posix_spawnattr_setsigmask
434 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
435 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
436 "posix_spawnattr_setsigmask is unportable - "
437 "use gnulib module posix_spawnattr_setsigmask for portability");
441 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
442 /* Get flag word from the attribute structure. */
443 # if @REPLACE_POSIX_SPAWN@
444 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
445 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
447 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
448 (const posix_spawnattr_t *_Restrict_ __attr,
449 short int *_Restrict_ __flags)
450 __THROW _GL_ARG_NONNULL ((1, 2)));
451 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
452 (const posix_spawnattr_t *_Restrict_ __attr,
453 short int *_Restrict_ __flags));
455 # if !@HAVE_POSIX_SPAWN@
456 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
457 (const posix_spawnattr_t *_Restrict_ __attr,
458 short int *_Restrict_ __flags)
459 __THROW _GL_ARG_NONNULL ((1, 2)));
461 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
462 (const posix_spawnattr_t *_Restrict_ __attr,
463 short int *_Restrict_ __flags));
465 _GL_CXXALIASWARN (posix_spawnattr_getflags);
466 #elif defined GNULIB_POSIXCHECK
467 # undef posix_spawnattr_getflags
468 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
469 _GL_WARN_ON_USE (posix_spawnattr_getflags,
470 "posix_spawnattr_getflags is unportable - "
471 "use gnulib module posix_spawnattr_getflags for portability");
475 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
476 /* Store flags in the attribute structure. */
477 # if @REPLACE_POSIX_SPAWN@
478 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
479 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
481 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
482 (posix_spawnattr_t *__attr, short int __flags)
483 __THROW _GL_ARG_NONNULL ((1)));
484 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
485 (posix_spawnattr_t *__attr, short int __flags));
487 # if !@HAVE_POSIX_SPAWN@
488 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
489 (posix_spawnattr_t *__attr, short int __flags)
490 __THROW _GL_ARG_NONNULL ((1)));
492 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
493 (posix_spawnattr_t *__attr, short int __flags));
495 _GL_CXXALIASWARN (posix_spawnattr_setflags);
496 #elif defined GNULIB_POSIXCHECK
497 # undef posix_spawnattr_setflags
498 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
499 _GL_WARN_ON_USE (posix_spawnattr_setflags,
500 "posix_spawnattr_setflags is unportable - "
501 "use gnulib module posix_spawnattr_setflags for portability");
505 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
506 /* Get process group ID from the attribute structure. */
507 # if @REPLACE_POSIX_SPAWN@
508 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
509 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
511 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
512 (const posix_spawnattr_t *_Restrict_ __attr,
513 pid_t *_Restrict_ __pgroup)
514 __THROW _GL_ARG_NONNULL ((1, 2)));
515 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
516 (const posix_spawnattr_t *_Restrict_ __attr,
517 pid_t *_Restrict_ __pgroup));
519 # if !@HAVE_POSIX_SPAWN@
520 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
521 (const posix_spawnattr_t *_Restrict_ __attr,
522 pid_t *_Restrict_ __pgroup)
523 __THROW _GL_ARG_NONNULL ((1, 2)));
525 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
526 (const posix_spawnattr_t *_Restrict_ __attr,
527 pid_t *_Restrict_ __pgroup));
529 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
530 #elif defined GNULIB_POSIXCHECK
531 # undef posix_spawnattr_getpgroup
532 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
533 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
534 "posix_spawnattr_getpgroup is unportable - "
535 "use gnulib module posix_spawnattr_getpgroup for portability");
539 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
540 /* Store process group ID in the attribute structure. */
541 # if @REPLACE_POSIX_SPAWN@
542 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
543 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
545 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
546 (posix_spawnattr_t *__attr, pid_t __pgroup)
547 __THROW _GL_ARG_NONNULL ((1)));
548 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
549 (posix_spawnattr_t *__attr, pid_t __pgroup));
551 # if !@HAVE_POSIX_SPAWN@
552 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
553 (posix_spawnattr_t *__attr, pid_t __pgroup)
554 __THROW _GL_ARG_NONNULL ((1)));
556 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
557 (posix_spawnattr_t *__attr, pid_t __pgroup));
559 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
560 #elif defined GNULIB_POSIXCHECK
561 # undef posix_spawnattr_setpgroup
562 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
563 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
564 "posix_spawnattr_setpgroup is unportable - "
565 "use gnulib module posix_spawnattr_setpgroup for portability");
569 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
570 /* Get scheduling policy from the attribute structure. */
571 # if @REPLACE_POSIX_SPAWN@
572 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
573 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
575 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
576 (const posix_spawnattr_t *_Restrict_ __attr,
577 int *_Restrict_ __schedpolicy)
578 __THROW _GL_ARG_NONNULL ((1, 2)));
579 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
580 (const posix_spawnattr_t *_Restrict_ __attr,
581 int *_Restrict_ __schedpolicy));
583 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
584 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
585 (const posix_spawnattr_t *_Restrict_ __attr,
586 int *_Restrict_ __schedpolicy)
587 __THROW _GL_ARG_NONNULL ((1, 2)));
589 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
590 (const posix_spawnattr_t *_Restrict_ __attr,
591 int *_Restrict_ __schedpolicy));
593 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
594 #elif defined GNULIB_POSIXCHECK
595 # undef posix_spawnattr_getschedpolicy
596 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
597 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
598 "posix_spawnattr_getschedpolicy is unportable - "
599 "use gnulib module posix_spawnattr_getschedpolicy for portability");
603 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
604 /* Store scheduling policy in the attribute structure. */
605 # if @REPLACE_POSIX_SPAWN@
606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
607 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
609 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
610 (posix_spawnattr_t *__attr, int __schedpolicy)
611 __THROW _GL_ARG_NONNULL ((1)));
612 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
613 (posix_spawnattr_t *__attr, int __schedpolicy));
615 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
616 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
617 (posix_spawnattr_t *__attr, int __schedpolicy)
618 __THROW _GL_ARG_NONNULL ((1)));
620 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
621 (posix_spawnattr_t *__attr, int __schedpolicy));
623 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
624 #elif defined GNULIB_POSIXCHECK
625 # undef posix_spawnattr_setschedpolicy
626 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
627 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
628 "posix_spawnattr_setschedpolicy is unportable - "
629 "use gnulib module posix_spawnattr_setschedpolicy for portability");
633 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
634 /* Get scheduling parameters from the attribute structure. */
635 # if @REPLACE_POSIX_SPAWN@
636 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
637 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
639 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
640 (const posix_spawnattr_t *_Restrict_ __attr,
641 struct sched_param *_Restrict_ __schedparam)
642 __THROW _GL_ARG_NONNULL ((1, 2)));
643 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
644 (const posix_spawnattr_t *_Restrict_ __attr,
645 struct sched_param *_Restrict_ __schedparam));
647 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
648 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
649 (const posix_spawnattr_t *_Restrict_ __attr,
650 struct sched_param *_Restrict_ __schedparam)
651 __THROW _GL_ARG_NONNULL ((1, 2)));
653 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
654 (const posix_spawnattr_t *_Restrict_ __attr,
655 struct sched_param *_Restrict_ __schedparam));
657 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
658 #elif defined GNULIB_POSIXCHECK
659 # undef posix_spawnattr_getschedparam
660 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
661 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
662 "posix_spawnattr_getschedparam is unportable - "
663 "use gnulib module posix_spawnattr_getschedparam for portability");
667 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
668 /* Store scheduling parameters in the attribute structure. */
669 # if @REPLACE_POSIX_SPAWN@
670 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
671 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
673 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
674 (posix_spawnattr_t *_Restrict_ __attr,
675 const struct sched_param *_Restrict_ __schedparam)
676 __THROW _GL_ARG_NONNULL ((1, 2)));
677 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
678 (posix_spawnattr_t *_Restrict_ __attr,
679 const struct sched_param *_Restrict_ __schedparam));
681 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
682 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
683 (posix_spawnattr_t *_Restrict_ __attr,
684 const struct sched_param *_Restrict_ __schedparam)
685 __THROW _GL_ARG_NONNULL ((1, 2)));
687 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
688 (posix_spawnattr_t *_Restrict_ __attr,
689 const struct sched_param *_Restrict_ __schedparam));
691 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
692 #elif defined GNULIB_POSIXCHECK
693 # undef posix_spawnattr_setschedparam
694 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
695 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
696 "posix_spawnattr_setschedparam is unportable - "
697 "use gnulib module posix_spawnattr_setschedparam for portability");
702 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
703 /* Initialize data structure for file attribute for `spawn' call. */
704 # if @REPLACE_POSIX_SPAWN@
705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
706 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
708 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
709 (posix_spawn_file_actions_t *__file_actions)
710 __THROW _GL_ARG_NONNULL ((1)));
711 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
712 (posix_spawn_file_actions_t *__file_actions));
714 # if !@HAVE_POSIX_SPAWN@
715 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
716 (posix_spawn_file_actions_t *__file_actions)
717 __THROW _GL_ARG_NONNULL ((1)));
719 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
720 (posix_spawn_file_actions_t *__file_actions));
722 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
723 #elif defined GNULIB_POSIXCHECK
724 # undef posix_spawn_file_actions_init
725 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
726 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
727 "posix_spawn_file_actions_init is unportable - "
728 "use gnulib module posix_spawn_file_actions_init for portability");
732 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
733 /* Free resources associated with FILE-ACTIONS. */
734 # if @REPLACE_POSIX_SPAWN@
735 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
736 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
738 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
739 (posix_spawn_file_actions_t *__file_actions)
740 __THROW _GL_ARG_NONNULL ((1)));
741 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
742 (posix_spawn_file_actions_t *__file_actions));
744 # if !@HAVE_POSIX_SPAWN@
745 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
746 (posix_spawn_file_actions_t *__file_actions)
747 __THROW _GL_ARG_NONNULL ((1)));
749 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
750 (posix_spawn_file_actions_t *__file_actions));
752 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
753 #elif defined GNULIB_POSIXCHECK
754 # undef posix_spawn_file_actions_destroy
755 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
756 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
757 "posix_spawn_file_actions_destroy is unportable - "
758 "use gnulib module posix_spawn_file_actions_destroy for portability");
762 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
763 /* Add an action to FILE-ACTIONS which tells the implementation to call
764 `open' for the given file during the `spawn' call. */
765 # if @REPLACE_POSIX_SPAWN@
766 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
767 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
769 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
770 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
772 const char *_Restrict_ __path, int __oflag, mode_t __mode)
773 __THROW _GL_ARG_NONNULL ((1, 3)));
774 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
775 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
777 const char *_Restrict_ __path, int __oflag, mode_t __mode));
779 # if !@HAVE_POSIX_SPAWN@
780 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
781 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
783 const char *_Restrict_ __path, int __oflag, mode_t __mode)
784 __THROW _GL_ARG_NONNULL ((1, 3)));
786 _GL_CXXALIAS_SYS (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 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
792 #elif defined GNULIB_POSIXCHECK
793 # undef posix_spawn_file_actions_addopen
794 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
795 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
796 "posix_spawn_file_actions_addopen is unportable - "
797 "use gnulib module posix_spawn_file_actions_addopen for portability");
801 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
802 /* Add an action to FILE-ACTIONS which tells the implementation to call
803 `close' for the given file descriptor during the `spawn' call. */
804 # if @REPLACE_POSIX_SPAWN@
805 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
806 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
808 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
809 (posix_spawn_file_actions_t *__file_actions, int __fd)
810 __THROW _GL_ARG_NONNULL ((1)));
811 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
812 (posix_spawn_file_actions_t *__file_actions, int __fd));
814 # if !@HAVE_POSIX_SPAWN@
815 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
816 (posix_spawn_file_actions_t *__file_actions, int __fd)
817 __THROW _GL_ARG_NONNULL ((1)));
819 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
820 (posix_spawn_file_actions_t *__file_actions, int __fd));
822 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
823 #elif defined GNULIB_POSIXCHECK
824 # undef posix_spawn_file_actions_addclose
825 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
826 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
827 "posix_spawn_file_actions_addclose is unportable - "
828 "use gnulib module posix_spawn_file_actions_addclose for portability");
832 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
833 /* Add an action to FILE-ACTIONS which tells the implementation to call
834 `dup2' for the given file descriptors during the `spawn' call. */
835 # if @REPLACE_POSIX_SPAWN@
836 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
839 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
840 (posix_spawn_file_actions_t *__file_actions,
841 int __fd, int __newfd)
842 __THROW _GL_ARG_NONNULL ((1)));
843 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
844 (posix_spawn_file_actions_t *__file_actions,
845 int __fd, int __newfd));
847 # if !@HAVE_POSIX_SPAWN@
848 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
849 (posix_spawn_file_actions_t *__file_actions,
850 int __fd, int __newfd)
851 __THROW _GL_ARG_NONNULL ((1)));
853 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
854 (posix_spawn_file_actions_t *__file_actions,
855 int __fd, int __newfd));
857 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
858 #elif defined GNULIB_POSIXCHECK
859 # undef posix_spawn_file_actions_adddup2
860 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
861 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
862 "posix_spawn_file_actions_adddup2 is unportable - "
863 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
868 #endif /* _GL_SPAWN_H */
869 #endif /* _GL_SPAWN_H */