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@
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. */
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) == 0)
157 #if @GNULIB_POSIX_SPAWN@
158 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
159 Before running the process perform the actions described in FILE-ACTIONS.
161 This function is a possible cancellation points and therefore not
162 marked with __THROW. */
163 # if @REPLACE_POSIX_SPAWN@
164 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
165 # define posix_spawn rpl_posix_spawn
167 _GL_FUNCDECL_RPL (posix_spawn, int,
168 (pid_t *_Restrict_ __pid,
169 const char *_Restrict_ __path,
170 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
171 const posix_spawnattr_t *_Restrict_ __attrp,
172 char *const argv[_Restrict_arr_],
173 char *const envp[_Restrict_arr_])
174 _GL_ARG_NONNULL ((2, 5, 6)));
175 _GL_CXXALIAS_RPL (posix_spawn, int,
176 (pid_t *_Restrict_ __pid,
177 const char *_Restrict_ __path,
178 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
179 const posix_spawnattr_t *_Restrict_ __attrp,
180 char *const argv[_Restrict_arr_],
181 char *const envp[_Restrict_arr_]));
183 # if !@HAVE_POSIX_SPAWN@
184 _GL_FUNCDECL_SYS (posix_spawn, int,
185 (pid_t *_Restrict_ __pid,
186 const char *_Restrict_ __path,
187 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
188 const posix_spawnattr_t *_Restrict_ __attrp,
189 char *const argv[_Restrict_arr_],
190 char *const envp[_Restrict_arr_])
191 _GL_ARG_NONNULL ((2, 5, 6)));
193 _GL_CXXALIAS_SYS (posix_spawn, int,
194 (pid_t *_Restrict_ __pid,
195 const char *_Restrict_ __path,
196 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
197 const posix_spawnattr_t *_Restrict_ __attrp,
198 char *const argv[_Restrict_arr_],
199 char *const envp[_Restrict_arr_]));
201 _GL_CXXALIASWARN (posix_spawn);
202 #elif defined GNULIB_POSIXCHECK
204 # if HAVE_RAW_DECL_POSIX_SPAWN
205 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
206 "use gnulib module posix_spawn for portability");
210 #if @GNULIB_POSIX_SPAWNP@
211 /* Similar to `posix_spawn' but search for FILE in the PATH.
213 This function is a possible cancellation points and therefore not
214 marked with __THROW. */
215 # if @REPLACE_POSIX_SPAWN@
216 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
217 # define posix_spawnp rpl_posix_spawnp
219 _GL_FUNCDECL_RPL (posix_spawnp, int,
220 (pid_t *__pid, const char *__file,
221 const posix_spawn_file_actions_t *__file_actions,
222 const posix_spawnattr_t *__attrp,
223 char *const argv[], char *const envp[])
224 _GL_ARG_NONNULL ((2, 5, 6)));
225 _GL_CXXALIAS_RPL (posix_spawnp, int,
226 (pid_t *__pid, const char *__file,
227 const posix_spawn_file_actions_t *__file_actions,
228 const posix_spawnattr_t *__attrp,
229 char *const argv[], char *const envp[]));
231 # if !@HAVE_POSIX_SPAWN@
232 _GL_FUNCDECL_SYS (posix_spawnp, int,
233 (pid_t *__pid, const char *__file,
234 const posix_spawn_file_actions_t *__file_actions,
235 const posix_spawnattr_t *__attrp,
236 char *const argv[], char *const envp[])
237 _GL_ARG_NONNULL ((2, 5, 6)));
239 _GL_CXXALIAS_SYS (posix_spawnp, int,
240 (pid_t *__pid, const char *__file,
241 const posix_spawn_file_actions_t *__file_actions,
242 const posix_spawnattr_t *__attrp,
243 char *const argv[], char *const envp[]));
245 _GL_CXXALIASWARN (posix_spawnp);
246 #elif defined GNULIB_POSIXCHECK
248 # if HAVE_RAW_DECL_POSIX_SPAWNP
249 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
250 "use gnulib module posix_spawnp for portability");
255 #if @GNULIB_POSIX_SPAWNATTR_INIT@
256 /* Initialize data structure with attributes for `spawn' to default values. */
257 # if @REPLACE_POSIX_SPAWN@
258 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
259 # define posix_spawnattr_init rpl_posix_spawnattr_init
261 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
262 __THROW _GL_ARG_NONNULL ((1)));
263 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
265 # if !@HAVE_POSIX_SPAWN@
266 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
267 __THROW _GL_ARG_NONNULL ((1)));
269 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
271 _GL_CXXALIASWARN (posix_spawnattr_init);
272 #elif defined GNULIB_POSIXCHECK
273 # undef posix_spawnattr_init
274 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
275 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
276 "use gnulib module posix_spawnattr_init for portability");
280 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
281 /* Free resources associated with ATTR. */
282 # if @REPLACE_POSIX_SPAWN@
283 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
284 # define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
286 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
287 __THROW _GL_ARG_NONNULL ((1)));
288 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
290 # if !@HAVE_POSIX_SPAWN@
291 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
292 __THROW _GL_ARG_NONNULL ((1)));
294 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
296 _GL_CXXALIASWARN (posix_spawnattr_destroy);
297 #elif defined GNULIB_POSIXCHECK
298 # undef posix_spawnattr_destroy
299 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
300 _GL_WARN_ON_USE (posix_spawnattr_destroy,
301 "posix_spawnattr_destroy is unportable - "
302 "use gnulib module posix_spawnattr_destroy for portability");
306 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
307 /* Store signal mask for signals with default handling from ATTR in
309 # if @REPLACE_POSIX_SPAWN@
310 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
311 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
313 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
314 (const posix_spawnattr_t *_Restrict_ __attr,
315 sigset_t *_Restrict_ __sigdefault)
316 __THROW _GL_ARG_NONNULL ((1, 2)));
317 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
318 (const posix_spawnattr_t *_Restrict_ __attr,
319 sigset_t *_Restrict_ __sigdefault));
321 # if !@HAVE_POSIX_SPAWN@
322 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
323 (const posix_spawnattr_t *_Restrict_ __attr,
324 sigset_t *_Restrict_ __sigdefault)
325 __THROW _GL_ARG_NONNULL ((1, 2)));
327 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
328 (const posix_spawnattr_t *_Restrict_ __attr,
329 sigset_t *_Restrict_ __sigdefault));
331 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
332 #elif defined GNULIB_POSIXCHECK
333 # undef posix_spawnattr_getsigdefault
334 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
335 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
336 "posix_spawnattr_getsigdefault is unportable - "
337 "use gnulib module posix_spawnattr_getsigdefault for portability");
341 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
342 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
343 # if @REPLACE_POSIX_SPAWN@
344 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
345 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
347 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
348 (posix_spawnattr_t *_Restrict_ __attr,
349 const sigset_t *_Restrict_ __sigdefault)
350 __THROW _GL_ARG_NONNULL ((1, 2)));
351 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
352 (posix_spawnattr_t *_Restrict_ __attr,
353 const sigset_t *_Restrict_ __sigdefault));
355 # if !@HAVE_POSIX_SPAWN@
356 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
357 (posix_spawnattr_t *_Restrict_ __attr,
358 const sigset_t *_Restrict_ __sigdefault)
359 __THROW _GL_ARG_NONNULL ((1, 2)));
361 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
362 (posix_spawnattr_t *_Restrict_ __attr,
363 const sigset_t *_Restrict_ __sigdefault));
365 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
366 #elif defined GNULIB_POSIXCHECK
367 # undef posix_spawnattr_setsigdefault
368 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
369 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
370 "posix_spawnattr_setsigdefault is unportable - "
371 "use gnulib module posix_spawnattr_setsigdefault for portability");
375 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
376 /* Store signal mask for the new process from ATTR in SIGMASK. */
377 # if @REPLACE_POSIX_SPAWN@
378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
379 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
381 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
382 (const posix_spawnattr_t *_Restrict_ __attr,
383 sigset_t *_Restrict_ __sigmask)
384 __THROW _GL_ARG_NONNULL ((1, 2)));
385 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
386 (const posix_spawnattr_t *_Restrict_ __attr,
387 sigset_t *_Restrict_ __sigmask));
389 # if !@HAVE_POSIX_SPAWN@
390 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
391 (const posix_spawnattr_t *_Restrict_ __attr,
392 sigset_t *_Restrict_ __sigmask)
393 __THROW _GL_ARG_NONNULL ((1, 2)));
395 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
396 (const posix_spawnattr_t *_Restrict_ __attr,
397 sigset_t *_Restrict_ __sigmask));
399 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
400 #elif defined GNULIB_POSIXCHECK
401 # undef posix_spawnattr_getsigmask
402 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
403 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
404 "posix_spawnattr_getsigmask is unportable - "
405 "use gnulib module posix_spawnattr_getsigmask for portability");
409 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
410 /* Set signal mask for the new process in ATTR to SIGMASK. */
411 # if @REPLACE_POSIX_SPAWN@
412 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
413 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
415 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
416 (posix_spawnattr_t *_Restrict_ __attr,
417 const sigset_t *_Restrict_ __sigmask)
418 __THROW _GL_ARG_NONNULL ((1, 2)));
419 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
420 (posix_spawnattr_t *_Restrict_ __attr,
421 const sigset_t *_Restrict_ __sigmask));
423 # if !@HAVE_POSIX_SPAWN@
424 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
425 (posix_spawnattr_t *_Restrict_ __attr,
426 const sigset_t *_Restrict_ __sigmask)
427 __THROW _GL_ARG_NONNULL ((1, 2)));
429 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
430 (posix_spawnattr_t *_Restrict_ __attr,
431 const sigset_t *_Restrict_ __sigmask));
433 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
434 #elif defined GNULIB_POSIXCHECK
435 # undef posix_spawnattr_setsigmask
436 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
437 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
438 "posix_spawnattr_setsigmask is unportable - "
439 "use gnulib module posix_spawnattr_setsigmask for portability");
443 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
444 /* Get flag word from the attribute structure. */
445 # if @REPLACE_POSIX_SPAWN@
446 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
447 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
449 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
450 (const posix_spawnattr_t *_Restrict_ __attr,
451 short int *_Restrict_ __flags)
452 __THROW _GL_ARG_NONNULL ((1, 2)));
453 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
454 (const posix_spawnattr_t *_Restrict_ __attr,
455 short int *_Restrict_ __flags));
457 # if !@HAVE_POSIX_SPAWN@
458 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
459 (const posix_spawnattr_t *_Restrict_ __attr,
460 short int *_Restrict_ __flags)
461 __THROW _GL_ARG_NONNULL ((1, 2)));
463 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
464 (const posix_spawnattr_t *_Restrict_ __attr,
465 short int *_Restrict_ __flags));
467 _GL_CXXALIASWARN (posix_spawnattr_getflags);
468 #elif defined GNULIB_POSIXCHECK
469 # undef posix_spawnattr_getflags
470 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
471 _GL_WARN_ON_USE (posix_spawnattr_getflags,
472 "posix_spawnattr_getflags is unportable - "
473 "use gnulib module posix_spawnattr_getflags for portability");
477 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
478 /* Store flags in the attribute structure. */
479 # if @REPLACE_POSIX_SPAWN@
480 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
481 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
483 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
484 (posix_spawnattr_t *__attr, short int __flags)
485 __THROW _GL_ARG_NONNULL ((1)));
486 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
487 (posix_spawnattr_t *__attr, short int __flags));
489 # if !@HAVE_POSIX_SPAWN@
490 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
491 (posix_spawnattr_t *__attr, short int __flags)
492 __THROW _GL_ARG_NONNULL ((1)));
494 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
495 (posix_spawnattr_t *__attr, short int __flags));
497 _GL_CXXALIASWARN (posix_spawnattr_setflags);
498 #elif defined GNULIB_POSIXCHECK
499 # undef posix_spawnattr_setflags
500 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
501 _GL_WARN_ON_USE (posix_spawnattr_setflags,
502 "posix_spawnattr_setflags is unportable - "
503 "use gnulib module posix_spawnattr_setflags for portability");
507 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
508 /* Get process group ID from the attribute structure. */
509 # if @REPLACE_POSIX_SPAWN@
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
513 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
514 (const posix_spawnattr_t *_Restrict_ __attr,
515 pid_t *_Restrict_ __pgroup)
516 __THROW _GL_ARG_NONNULL ((1, 2)));
517 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
518 (const posix_spawnattr_t *_Restrict_ __attr,
519 pid_t *_Restrict_ __pgroup));
521 # if !@HAVE_POSIX_SPAWN@
522 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
523 (const posix_spawnattr_t *_Restrict_ __attr,
524 pid_t *_Restrict_ __pgroup)
525 __THROW _GL_ARG_NONNULL ((1, 2)));
527 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
528 (const posix_spawnattr_t *_Restrict_ __attr,
529 pid_t *_Restrict_ __pgroup));
531 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
532 #elif defined GNULIB_POSIXCHECK
533 # undef posix_spawnattr_getpgroup
534 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
535 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
536 "posix_spawnattr_getpgroup is unportable - "
537 "use gnulib module posix_spawnattr_getpgroup for portability");
541 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
542 /* Store process group ID in the attribute structure. */
543 # if @REPLACE_POSIX_SPAWN@
544 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
545 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
547 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
548 (posix_spawnattr_t *__attr, pid_t __pgroup)
549 __THROW _GL_ARG_NONNULL ((1)));
550 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
551 (posix_spawnattr_t *__attr, pid_t __pgroup));
553 # if !@HAVE_POSIX_SPAWN@
554 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
555 (posix_spawnattr_t *__attr, pid_t __pgroup)
556 __THROW _GL_ARG_NONNULL ((1)));
558 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
559 (posix_spawnattr_t *__attr, pid_t __pgroup));
561 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
562 #elif defined GNULIB_POSIXCHECK
563 # undef posix_spawnattr_setpgroup
564 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
565 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
566 "posix_spawnattr_setpgroup is unportable - "
567 "use gnulib module posix_spawnattr_setpgroup for portability");
571 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
572 /* Get scheduling policy from the attribute structure. */
573 # if @REPLACE_POSIX_SPAWN@
574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
575 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
577 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
578 (const posix_spawnattr_t *_Restrict_ __attr,
579 int *_Restrict_ __schedpolicy)
580 __THROW _GL_ARG_NONNULL ((1, 2)));
581 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
582 (const posix_spawnattr_t *_Restrict_ __attr,
583 int *_Restrict_ __schedpolicy));
585 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
586 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
587 (const posix_spawnattr_t *_Restrict_ __attr,
588 int *_Restrict_ __schedpolicy)
589 __THROW _GL_ARG_NONNULL ((1, 2)));
591 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
592 (const posix_spawnattr_t *_Restrict_ __attr,
593 int *_Restrict_ __schedpolicy));
595 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
596 #elif defined GNULIB_POSIXCHECK
597 # undef posix_spawnattr_getschedpolicy
598 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
599 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
600 "posix_spawnattr_getschedpolicy is unportable - "
601 "use gnulib module posix_spawnattr_getschedpolicy for portability");
605 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
606 /* Store scheduling policy in the attribute structure. */
607 # if @REPLACE_POSIX_SPAWN@
608 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
609 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
611 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
612 (posix_spawnattr_t *__attr, int __schedpolicy)
613 __THROW _GL_ARG_NONNULL ((1)));
614 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
615 (posix_spawnattr_t *__attr, int __schedpolicy));
617 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
618 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
619 (posix_spawnattr_t *__attr, int __schedpolicy)
620 __THROW _GL_ARG_NONNULL ((1)));
622 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
623 (posix_spawnattr_t *__attr, int __schedpolicy));
625 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
626 #elif defined GNULIB_POSIXCHECK
627 # undef posix_spawnattr_setschedpolicy
628 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
629 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
630 "posix_spawnattr_setschedpolicy is unportable - "
631 "use gnulib module posix_spawnattr_setschedpolicy for portability");
635 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
636 /* Get scheduling parameters from the attribute structure. */
637 # if @REPLACE_POSIX_SPAWN@
638 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
639 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
641 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
642 (const posix_spawnattr_t *_Restrict_ __attr,
643 struct sched_param *_Restrict_ __schedparam)
644 __THROW _GL_ARG_NONNULL ((1, 2)));
645 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
646 (const posix_spawnattr_t *_Restrict_ __attr,
647 struct sched_param *_Restrict_ __schedparam));
649 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
650 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
651 (const posix_spawnattr_t *_Restrict_ __attr,
652 struct sched_param *_Restrict_ __schedparam)
653 __THROW _GL_ARG_NONNULL ((1, 2)));
655 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
656 (const posix_spawnattr_t *_Restrict_ __attr,
657 struct sched_param *_Restrict_ __schedparam));
659 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
660 #elif defined GNULIB_POSIXCHECK
661 # undef posix_spawnattr_getschedparam
662 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
663 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
664 "posix_spawnattr_getschedparam is unportable - "
665 "use gnulib module posix_spawnattr_getschedparam for portability");
669 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
670 /* Store scheduling parameters in the attribute structure. */
671 # if @REPLACE_POSIX_SPAWN@
672 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
673 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
675 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
676 (posix_spawnattr_t *_Restrict_ __attr,
677 const struct sched_param *_Restrict_ __schedparam)
678 __THROW _GL_ARG_NONNULL ((1, 2)));
679 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
680 (posix_spawnattr_t *_Restrict_ __attr,
681 const struct sched_param *_Restrict_ __schedparam));
683 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
684 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
685 (posix_spawnattr_t *_Restrict_ __attr,
686 const struct sched_param *_Restrict_ __schedparam)
687 __THROW _GL_ARG_NONNULL ((1, 2)));
689 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
690 (posix_spawnattr_t *_Restrict_ __attr,
691 const struct sched_param *_Restrict_ __schedparam));
693 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
694 #elif defined GNULIB_POSIXCHECK
695 # undef posix_spawnattr_setschedparam
696 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
697 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
698 "posix_spawnattr_setschedparam is unportable - "
699 "use gnulib module posix_spawnattr_setschedparam for portability");
704 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
705 /* Initialize data structure for file attribute for `spawn' call. */
706 # if @REPLACE_POSIX_SPAWN@
707 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
708 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
710 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
711 (posix_spawn_file_actions_t *__file_actions)
712 __THROW _GL_ARG_NONNULL ((1)));
713 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
714 (posix_spawn_file_actions_t *__file_actions));
716 # if !@HAVE_POSIX_SPAWN@
717 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
718 (posix_spawn_file_actions_t *__file_actions)
719 __THROW _GL_ARG_NONNULL ((1)));
721 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
722 (posix_spawn_file_actions_t *__file_actions));
724 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
725 #elif defined GNULIB_POSIXCHECK
726 # undef posix_spawn_file_actions_init
727 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
728 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
729 "posix_spawn_file_actions_init is unportable - "
730 "use gnulib module posix_spawn_file_actions_init for portability");
734 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
735 /* Free resources associated with FILE-ACTIONS. */
736 # if @REPLACE_POSIX_SPAWN@
737 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
738 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
740 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
741 (posix_spawn_file_actions_t *__file_actions)
742 __THROW _GL_ARG_NONNULL ((1)));
743 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
744 (posix_spawn_file_actions_t *__file_actions));
746 # if !@HAVE_POSIX_SPAWN@
747 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
748 (posix_spawn_file_actions_t *__file_actions)
749 __THROW _GL_ARG_NONNULL ((1)));
751 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
752 (posix_spawn_file_actions_t *__file_actions));
754 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
755 #elif defined GNULIB_POSIXCHECK
756 # undef posix_spawn_file_actions_destroy
757 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
758 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
759 "posix_spawn_file_actions_destroy is unportable - "
760 "use gnulib module posix_spawn_file_actions_destroy for portability");
764 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
765 /* Add an action to FILE-ACTIONS which tells the implementation to call
766 `open' for the given file during the `spawn' call. */
767 # if @REPLACE_POSIX_SPAWN@
768 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
769 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
771 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
772 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
774 const char *_Restrict_ __path, int __oflag, mode_t __mode)
775 __THROW _GL_ARG_NONNULL ((1, 3)));
776 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
777 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
779 const char *_Restrict_ __path, int __oflag, mode_t __mode));
781 # if !@HAVE_POSIX_SPAWN@
782 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
783 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
785 const char *_Restrict_ __path, int __oflag, mode_t __mode)
786 __THROW _GL_ARG_NONNULL ((1, 3)));
788 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
789 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
791 const char *_Restrict_ __path, int __oflag, mode_t __mode));
793 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
794 #elif defined GNULIB_POSIXCHECK
795 # undef posix_spawn_file_actions_addopen
796 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
797 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
798 "posix_spawn_file_actions_addopen is unportable - "
799 "use gnulib module posix_spawn_file_actions_addopen for portability");
803 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
804 /* Add an action to FILE-ACTIONS which tells the implementation to call
805 `close' for the given file descriptor during the `spawn' call. */
806 # if @REPLACE_POSIX_SPAWN@
807 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
808 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
810 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
811 (posix_spawn_file_actions_t *__file_actions, int __fd)
812 __THROW _GL_ARG_NONNULL ((1)));
813 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
814 (posix_spawn_file_actions_t *__file_actions, int __fd));
816 # if !@HAVE_POSIX_SPAWN@
817 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
818 (posix_spawn_file_actions_t *__file_actions, int __fd)
819 __THROW _GL_ARG_NONNULL ((1)));
821 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
822 (posix_spawn_file_actions_t *__file_actions, int __fd));
824 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
825 #elif defined GNULIB_POSIXCHECK
826 # undef posix_spawn_file_actions_addclose
827 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
828 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
829 "posix_spawn_file_actions_addclose is unportable - "
830 "use gnulib module posix_spawn_file_actions_addclose for portability");
834 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
835 /* Add an action to FILE-ACTIONS which tells the implementation to call
836 `dup2' for the given file descriptors during the `spawn' call. */
837 # if @REPLACE_POSIX_SPAWN@
838 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
839 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
841 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
842 (posix_spawn_file_actions_t *__file_actions,
843 int __fd, int __newfd)
844 __THROW _GL_ARG_NONNULL ((1)));
845 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
846 (posix_spawn_file_actions_t *__file_actions,
847 int __fd, int __newfd));
849 # if !@HAVE_POSIX_SPAWN@
850 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
851 (posix_spawn_file_actions_t *__file_actions,
852 int __fd, int __newfd)
853 __THROW _GL_ARG_NONNULL ((1)));
855 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
856 (posix_spawn_file_actions_t *__file_actions,
857 int __fd, int __newfd));
859 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
860 #elif defined GNULIB_POSIXCHECK
861 # undef posix_spawn_file_actions_adddup2
862 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
863 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
864 "posix_spawn_file_actions_adddup2 is unportable - "
865 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
870 #endif /* _GL_SPAWN_H */
871 #endif /* _GL_SPAWN_H */