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 [2 * (((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) - 1];
156 #if @GNULIB_POSIX_SPAWN@
157 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
158 Before running the process perform the actions described in FILE-ACTIONS.
160 This function is a possible cancellation points and therefore not
161 marked with __THROW. */
162 # if @REPLACE_POSIX_SPAWN@
163 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
164 # define posix_spawn rpl_posix_spawn
166 _GL_FUNCDECL_RPL (posix_spawn, int,
167 (pid_t *_Restrict_ __pid,
168 const char *_Restrict_ __path,
169 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
170 const posix_spawnattr_t *_Restrict_ __attrp,
171 char *const argv[_Restrict_arr_],
172 char *const envp[_Restrict_arr_])
173 _GL_ARG_NONNULL ((2, 5, 6)));
174 _GL_CXXALIAS_RPL (posix_spawn, int,
175 (pid_t *_Restrict_ __pid,
176 const char *_Restrict_ __path,
177 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
178 const posix_spawnattr_t *_Restrict_ __attrp,
179 char *const argv[_Restrict_arr_],
180 char *const envp[_Restrict_arr_]));
182 # if !@HAVE_POSIX_SPAWN@
183 _GL_FUNCDECL_SYS (posix_spawn, int,
184 (pid_t *_Restrict_ __pid,
185 const char *_Restrict_ __path,
186 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
187 const posix_spawnattr_t *_Restrict_ __attrp,
188 char *const argv[_Restrict_arr_],
189 char *const envp[_Restrict_arr_])
190 _GL_ARG_NONNULL ((2, 5, 6)));
192 _GL_CXXALIAS_SYS (posix_spawn, int,
193 (pid_t *_Restrict_ __pid,
194 const char *_Restrict_ __path,
195 const posix_spawn_file_actions_t *_Restrict_ __file_actions,
196 const posix_spawnattr_t *_Restrict_ __attrp,
197 char *const argv[_Restrict_arr_],
198 char *const envp[_Restrict_arr_]));
200 _GL_CXXALIASWARN (posix_spawn);
201 #elif defined GNULIB_POSIXCHECK
203 # if HAVE_RAW_DECL_POSIX_SPAWN
204 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
205 "use gnulib module posix_spawn for portability");
209 #if @GNULIB_POSIX_SPAWNP@
210 /* Similar to `posix_spawn' but search for FILE in the PATH.
212 This function is a possible cancellation points and therefore not
213 marked with __THROW. */
214 # if @REPLACE_POSIX_SPAWN@
215 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
216 # define posix_spawnp rpl_posix_spawnp
218 _GL_FUNCDECL_RPL (posix_spawnp, int,
219 (pid_t *__pid, const char *__file,
220 const posix_spawn_file_actions_t *__file_actions,
221 const posix_spawnattr_t *__attrp,
222 char *const argv[], char *const envp[])
223 _GL_ARG_NONNULL ((2, 5, 6)));
224 _GL_CXXALIAS_RPL (posix_spawnp, int,
225 (pid_t *__pid, const char *__file,
226 const posix_spawn_file_actions_t *__file_actions,
227 const posix_spawnattr_t *__attrp,
228 char *const argv[], char *const envp[]));
230 # if !@HAVE_POSIX_SPAWN@
231 _GL_FUNCDECL_SYS (posix_spawnp, int,
232 (pid_t *__pid, const char *__file,
233 const posix_spawn_file_actions_t *__file_actions,
234 const posix_spawnattr_t *__attrp,
235 char *const argv[], char *const envp[])
236 _GL_ARG_NONNULL ((2, 5, 6)));
238 _GL_CXXALIAS_SYS (posix_spawnp, int,
239 (pid_t *__pid, const char *__file,
240 const posix_spawn_file_actions_t *__file_actions,
241 const posix_spawnattr_t *__attrp,
242 char *const argv[], char *const envp[]));
244 _GL_CXXALIASWARN (posix_spawnp);
245 #elif defined GNULIB_POSIXCHECK
247 # if HAVE_RAW_DECL_POSIX_SPAWNP
248 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
249 "use gnulib module posix_spawnp for portability");
254 #if @GNULIB_POSIX_SPAWNATTR_INIT@
255 /* Initialize data structure with attributes for `spawn' to default values. */
256 # if @REPLACE_POSIX_SPAWN@
257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
258 # define posix_spawnattr_init rpl_posix_spawnattr_init
260 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
261 __THROW _GL_ARG_NONNULL ((1)));
262 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
264 # if !@HAVE_POSIX_SPAWN@
265 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
266 __THROW _GL_ARG_NONNULL ((1)));
268 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
270 _GL_CXXALIASWARN (posix_spawnattr_init);
271 #elif defined GNULIB_POSIXCHECK
272 # undef posix_spawnattr_init
273 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
274 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
275 "use gnulib module posix_spawnattr_init for portability");
279 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
280 /* Free resources associated with ATTR. */
281 # if @REPLACE_POSIX_SPAWN@
282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
283 # define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
285 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
286 __THROW _GL_ARG_NONNULL ((1)));
287 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
289 # if !@HAVE_POSIX_SPAWN@
290 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
291 __THROW _GL_ARG_NONNULL ((1)));
293 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
295 _GL_CXXALIASWARN (posix_spawnattr_destroy);
296 #elif defined GNULIB_POSIXCHECK
297 # undef posix_spawnattr_destroy
298 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
299 _GL_WARN_ON_USE (posix_spawnattr_destroy,
300 "posix_spawnattr_destroy is unportable - "
301 "use gnulib module posix_spawnattr_destroy for portability");
305 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
306 /* Store signal mask for signals with default handling from ATTR in
308 # if @REPLACE_POSIX_SPAWN@
309 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
310 # define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
312 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
313 (const posix_spawnattr_t *_Restrict_ __attr,
314 sigset_t *_Restrict_ __sigdefault)
315 __THROW _GL_ARG_NONNULL ((1, 2)));
316 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
317 (const posix_spawnattr_t *_Restrict_ __attr,
318 sigset_t *_Restrict_ __sigdefault));
320 # if !@HAVE_POSIX_SPAWN@
321 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
322 (const posix_spawnattr_t *_Restrict_ __attr,
323 sigset_t *_Restrict_ __sigdefault)
324 __THROW _GL_ARG_NONNULL ((1, 2)));
326 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
327 (const posix_spawnattr_t *_Restrict_ __attr,
328 sigset_t *_Restrict_ __sigdefault));
330 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
331 #elif defined GNULIB_POSIXCHECK
332 # undef posix_spawnattr_getsigdefault
333 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
334 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
335 "posix_spawnattr_getsigdefault is unportable - "
336 "use gnulib module posix_spawnattr_getsigdefault for portability");
340 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
341 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
342 # if @REPLACE_POSIX_SPAWN@
343 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
344 # define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
346 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
347 (posix_spawnattr_t *_Restrict_ __attr,
348 const sigset_t *_Restrict_ __sigdefault)
349 __THROW _GL_ARG_NONNULL ((1, 2)));
350 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
351 (posix_spawnattr_t *_Restrict_ __attr,
352 const sigset_t *_Restrict_ __sigdefault));
354 # if !@HAVE_POSIX_SPAWN@
355 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
356 (posix_spawnattr_t *_Restrict_ __attr,
357 const sigset_t *_Restrict_ __sigdefault)
358 __THROW _GL_ARG_NONNULL ((1, 2)));
360 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
361 (posix_spawnattr_t *_Restrict_ __attr,
362 const sigset_t *_Restrict_ __sigdefault));
364 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
365 #elif defined GNULIB_POSIXCHECK
366 # undef posix_spawnattr_setsigdefault
367 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
368 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
369 "posix_spawnattr_setsigdefault is unportable - "
370 "use gnulib module posix_spawnattr_setsigdefault for portability");
374 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
375 /* Store signal mask for the new process from ATTR in SIGMASK. */
376 # if @REPLACE_POSIX_SPAWN@
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
378 # define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
380 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
381 (const posix_spawnattr_t *_Restrict_ __attr,
382 sigset_t *_Restrict_ __sigmask)
383 __THROW _GL_ARG_NONNULL ((1, 2)));
384 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
385 (const posix_spawnattr_t *_Restrict_ __attr,
386 sigset_t *_Restrict_ __sigmask));
388 # if !@HAVE_POSIX_SPAWN@
389 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
390 (const posix_spawnattr_t *_Restrict_ __attr,
391 sigset_t *_Restrict_ __sigmask)
392 __THROW _GL_ARG_NONNULL ((1, 2)));
394 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
395 (const posix_spawnattr_t *_Restrict_ __attr,
396 sigset_t *_Restrict_ __sigmask));
398 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
399 #elif defined GNULIB_POSIXCHECK
400 # undef posix_spawnattr_getsigmask
401 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
402 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
403 "posix_spawnattr_getsigmask is unportable - "
404 "use gnulib module posix_spawnattr_getsigmask for portability");
408 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
409 /* Set signal mask for the new process in ATTR to SIGMASK. */
410 # if @REPLACE_POSIX_SPAWN@
411 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
412 # define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
414 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
415 (posix_spawnattr_t *_Restrict_ __attr,
416 const sigset_t *_Restrict_ __sigmask)
417 __THROW _GL_ARG_NONNULL ((1, 2)));
418 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
419 (posix_spawnattr_t *_Restrict_ __attr,
420 const sigset_t *_Restrict_ __sigmask));
422 # if !@HAVE_POSIX_SPAWN@
423 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
424 (posix_spawnattr_t *_Restrict_ __attr,
425 const sigset_t *_Restrict_ __sigmask)
426 __THROW _GL_ARG_NONNULL ((1, 2)));
428 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
429 (posix_spawnattr_t *_Restrict_ __attr,
430 const sigset_t *_Restrict_ __sigmask));
432 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
433 #elif defined GNULIB_POSIXCHECK
434 # undef posix_spawnattr_setsigmask
435 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
436 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
437 "posix_spawnattr_setsigmask is unportable - "
438 "use gnulib module posix_spawnattr_setsigmask for portability");
442 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
443 /* Get flag word from the attribute structure. */
444 # if @REPLACE_POSIX_SPAWN@
445 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
446 # define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
448 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
449 (const posix_spawnattr_t *_Restrict_ __attr,
450 short int *_Restrict_ __flags)
451 __THROW _GL_ARG_NONNULL ((1, 2)));
452 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
453 (const posix_spawnattr_t *_Restrict_ __attr,
454 short int *_Restrict_ __flags));
456 # if !@HAVE_POSIX_SPAWN@
457 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
458 (const posix_spawnattr_t *_Restrict_ __attr,
459 short int *_Restrict_ __flags)
460 __THROW _GL_ARG_NONNULL ((1, 2)));
462 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
463 (const posix_spawnattr_t *_Restrict_ __attr,
464 short int *_Restrict_ __flags));
466 _GL_CXXALIASWARN (posix_spawnattr_getflags);
467 #elif defined GNULIB_POSIXCHECK
468 # undef posix_spawnattr_getflags
469 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
470 _GL_WARN_ON_USE (posix_spawnattr_getflags,
471 "posix_spawnattr_getflags is unportable - "
472 "use gnulib module posix_spawnattr_getflags for portability");
476 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
477 /* Store flags in the attribute structure. */
478 # if @REPLACE_POSIX_SPAWN@
479 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
480 # define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
482 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
483 (posix_spawnattr_t *__attr, short int __flags)
484 __THROW _GL_ARG_NONNULL ((1)));
485 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
486 (posix_spawnattr_t *__attr, short int __flags));
488 # if !@HAVE_POSIX_SPAWN@
489 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
490 (posix_spawnattr_t *__attr, short int __flags)
491 __THROW _GL_ARG_NONNULL ((1)));
493 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
494 (posix_spawnattr_t *__attr, short int __flags));
496 _GL_CXXALIASWARN (posix_spawnattr_setflags);
497 #elif defined GNULIB_POSIXCHECK
498 # undef posix_spawnattr_setflags
499 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
500 _GL_WARN_ON_USE (posix_spawnattr_setflags,
501 "posix_spawnattr_setflags is unportable - "
502 "use gnulib module posix_spawnattr_setflags for portability");
506 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
507 /* Get process group ID from the attribute structure. */
508 # if @REPLACE_POSIX_SPAWN@
509 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
510 # define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
512 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
513 (const posix_spawnattr_t *_Restrict_ __attr,
514 pid_t *_Restrict_ __pgroup)
515 __THROW _GL_ARG_NONNULL ((1, 2)));
516 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
517 (const posix_spawnattr_t *_Restrict_ __attr,
518 pid_t *_Restrict_ __pgroup));
520 # if !@HAVE_POSIX_SPAWN@
521 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
522 (const posix_spawnattr_t *_Restrict_ __attr,
523 pid_t *_Restrict_ __pgroup)
524 __THROW _GL_ARG_NONNULL ((1, 2)));
526 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
527 (const posix_spawnattr_t *_Restrict_ __attr,
528 pid_t *_Restrict_ __pgroup));
530 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
531 #elif defined GNULIB_POSIXCHECK
532 # undef posix_spawnattr_getpgroup
533 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
534 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
535 "posix_spawnattr_getpgroup is unportable - "
536 "use gnulib module posix_spawnattr_getpgroup for portability");
540 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
541 /* Store process group ID in the attribute structure. */
542 # if @REPLACE_POSIX_SPAWN@
543 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
544 # define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
546 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
547 (posix_spawnattr_t *__attr, pid_t __pgroup)
548 __THROW _GL_ARG_NONNULL ((1)));
549 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
550 (posix_spawnattr_t *__attr, pid_t __pgroup));
552 # if !@HAVE_POSIX_SPAWN@
553 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
554 (posix_spawnattr_t *__attr, pid_t __pgroup)
555 __THROW _GL_ARG_NONNULL ((1)));
557 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
558 (posix_spawnattr_t *__attr, pid_t __pgroup));
560 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
561 #elif defined GNULIB_POSIXCHECK
562 # undef posix_spawnattr_setpgroup
563 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
564 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
565 "posix_spawnattr_setpgroup is unportable - "
566 "use gnulib module posix_spawnattr_setpgroup for portability");
570 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
571 /* Get scheduling policy from the attribute structure. */
572 # if @REPLACE_POSIX_SPAWN@
573 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
574 # define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
576 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
577 (const posix_spawnattr_t *_Restrict_ __attr,
578 int *_Restrict_ __schedpolicy)
579 __THROW _GL_ARG_NONNULL ((1, 2)));
580 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
581 (const posix_spawnattr_t *_Restrict_ __attr,
582 int *_Restrict_ __schedpolicy));
584 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
585 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
586 (const posix_spawnattr_t *_Restrict_ __attr,
587 int *_Restrict_ __schedpolicy)
588 __THROW _GL_ARG_NONNULL ((1, 2)));
590 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
591 (const posix_spawnattr_t *_Restrict_ __attr,
592 int *_Restrict_ __schedpolicy));
594 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
595 #elif defined GNULIB_POSIXCHECK
596 # undef posix_spawnattr_getschedpolicy
597 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
598 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
599 "posix_spawnattr_getschedpolicy is unportable - "
600 "use gnulib module posix_spawnattr_getschedpolicy for portability");
604 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
605 /* Store scheduling policy in the attribute structure. */
606 # if @REPLACE_POSIX_SPAWN@
607 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
608 # define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
610 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
611 (posix_spawnattr_t *__attr, int __schedpolicy)
612 __THROW _GL_ARG_NONNULL ((1)));
613 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
614 (posix_spawnattr_t *__attr, int __schedpolicy));
616 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
617 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
618 (posix_spawnattr_t *__attr, int __schedpolicy)
619 __THROW _GL_ARG_NONNULL ((1)));
621 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
622 (posix_spawnattr_t *__attr, int __schedpolicy));
624 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
625 #elif defined GNULIB_POSIXCHECK
626 # undef posix_spawnattr_setschedpolicy
627 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
628 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
629 "posix_spawnattr_setschedpolicy is unportable - "
630 "use gnulib module posix_spawnattr_setschedpolicy for portability");
634 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
635 /* Get scheduling parameters from the attribute structure. */
636 # if @REPLACE_POSIX_SPAWN@
637 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
638 # define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
640 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
641 (const posix_spawnattr_t *_Restrict_ __attr,
642 struct sched_param *_Restrict_ __schedparam)
643 __THROW _GL_ARG_NONNULL ((1, 2)));
644 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
645 (const posix_spawnattr_t *_Restrict_ __attr,
646 struct sched_param *_Restrict_ __schedparam));
648 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
649 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
650 (const posix_spawnattr_t *_Restrict_ __attr,
651 struct sched_param *_Restrict_ __schedparam)
652 __THROW _GL_ARG_NONNULL ((1, 2)));
654 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
655 (const posix_spawnattr_t *_Restrict_ __attr,
656 struct sched_param *_Restrict_ __schedparam));
658 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
659 #elif defined GNULIB_POSIXCHECK
660 # undef posix_spawnattr_getschedparam
661 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
662 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
663 "posix_spawnattr_getschedparam is unportable - "
664 "use gnulib module posix_spawnattr_getschedparam for portability");
668 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
669 /* Store scheduling parameters in the attribute structure. */
670 # if @REPLACE_POSIX_SPAWN@
671 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
672 # define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
674 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
675 (posix_spawnattr_t *_Restrict_ __attr,
676 const struct sched_param *_Restrict_ __schedparam)
677 __THROW _GL_ARG_NONNULL ((1, 2)));
678 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
679 (posix_spawnattr_t *_Restrict_ __attr,
680 const struct sched_param *_Restrict_ __schedparam));
682 # if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
683 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
684 (posix_spawnattr_t *_Restrict_ __attr,
685 const struct sched_param *_Restrict_ __schedparam)
686 __THROW _GL_ARG_NONNULL ((1, 2)));
688 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
689 (posix_spawnattr_t *_Restrict_ __attr,
690 const struct sched_param *_Restrict_ __schedparam));
692 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
693 #elif defined GNULIB_POSIXCHECK
694 # undef posix_spawnattr_setschedparam
695 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
696 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
697 "posix_spawnattr_setschedparam is unportable - "
698 "use gnulib module posix_spawnattr_setschedparam for portability");
703 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
704 /* Initialize data structure for file attribute for `spawn' call. */
705 # if @REPLACE_POSIX_SPAWN@
706 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
707 # define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
709 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
710 (posix_spawn_file_actions_t *__file_actions)
711 __THROW _GL_ARG_NONNULL ((1)));
712 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
713 (posix_spawn_file_actions_t *__file_actions));
715 # if !@HAVE_POSIX_SPAWN@
716 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
717 (posix_spawn_file_actions_t *__file_actions)
718 __THROW _GL_ARG_NONNULL ((1)));
720 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
721 (posix_spawn_file_actions_t *__file_actions));
723 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
724 #elif defined GNULIB_POSIXCHECK
725 # undef posix_spawn_file_actions_init
726 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
727 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
728 "posix_spawn_file_actions_init is unportable - "
729 "use gnulib module posix_spawn_file_actions_init for portability");
733 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
734 /* Free resources associated with FILE-ACTIONS. */
735 # if @REPLACE_POSIX_SPAWN@
736 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
737 # define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
739 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
740 (posix_spawn_file_actions_t *__file_actions)
741 __THROW _GL_ARG_NONNULL ((1)));
742 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
743 (posix_spawn_file_actions_t *__file_actions));
745 # if !@HAVE_POSIX_SPAWN@
746 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
747 (posix_spawn_file_actions_t *__file_actions)
748 __THROW _GL_ARG_NONNULL ((1)));
750 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
751 (posix_spawn_file_actions_t *__file_actions));
753 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
754 #elif defined GNULIB_POSIXCHECK
755 # undef posix_spawn_file_actions_destroy
756 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
757 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
758 "posix_spawn_file_actions_destroy is unportable - "
759 "use gnulib module posix_spawn_file_actions_destroy for portability");
763 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
764 /* Add an action to FILE-ACTIONS which tells the implementation to call
765 `open' for the given file during the `spawn' call. */
766 # if @REPLACE_POSIX_SPAWN@
767 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
768 # define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
770 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
771 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
773 const char *_Restrict_ __path, int __oflag, mode_t __mode)
774 __THROW _GL_ARG_NONNULL ((1, 3)));
775 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
776 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
778 const char *_Restrict_ __path, int __oflag, mode_t __mode));
780 # if !@HAVE_POSIX_SPAWN@
781 _GL_FUNCDECL_SYS (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)));
787 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
788 (posix_spawn_file_actions_t *_Restrict_ __file_actions,
790 const char *_Restrict_ __path, int __oflag, mode_t __mode));
792 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
793 #elif defined GNULIB_POSIXCHECK
794 # undef posix_spawn_file_actions_addopen
795 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
796 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
797 "posix_spawn_file_actions_addopen is unportable - "
798 "use gnulib module posix_spawn_file_actions_addopen for portability");
802 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
803 /* Add an action to FILE-ACTIONS which tells the implementation to call
804 `close' for the given file descriptor during the `spawn' call. */
805 # if @REPLACE_POSIX_SPAWN@
806 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
807 # define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
809 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
810 (posix_spawn_file_actions_t *__file_actions, int __fd)
811 __THROW _GL_ARG_NONNULL ((1)));
812 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
813 (posix_spawn_file_actions_t *__file_actions, int __fd));
815 # if !@HAVE_POSIX_SPAWN@
816 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
817 (posix_spawn_file_actions_t *__file_actions, int __fd)
818 __THROW _GL_ARG_NONNULL ((1)));
820 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
821 (posix_spawn_file_actions_t *__file_actions, int __fd));
823 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
824 #elif defined GNULIB_POSIXCHECK
825 # undef posix_spawn_file_actions_addclose
826 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
827 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
828 "posix_spawn_file_actions_addclose is unportable - "
829 "use gnulib module posix_spawn_file_actions_addclose for portability");
833 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
834 /* Add an action to FILE-ACTIONS which tells the implementation to call
835 `dup2' for the given file descriptors during the `spawn' call. */
836 # if @REPLACE_POSIX_SPAWN@
837 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
838 # define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
840 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
841 (posix_spawn_file_actions_t *__file_actions,
842 int __fd, int __newfd)
843 __THROW _GL_ARG_NONNULL ((1)));
844 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
845 (posix_spawn_file_actions_t *__file_actions,
846 int __fd, int __newfd));
848 # if !@HAVE_POSIX_SPAWN@
849 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
850 (posix_spawn_file_actions_t *__file_actions,
851 int __fd, int __newfd)
852 __THROW _GL_ARG_NONNULL ((1)));
854 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
855 (posix_spawn_file_actions_t *__file_actions,
856 int __fd, int __newfd));
858 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
859 #elif defined GNULIB_POSIXCHECK
860 # undef posix_spawn_file_actions_adddup2
861 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
862 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
863 "posix_spawn_file_actions_adddup2 is unportable - "
864 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
869 #endif /* _GL_SPAWN_H */
870 #endif /* _GL_SPAWN_H */