1 /* Definitions for POSIX spawn interface.
2    Copyright (C) 2000, 2003-2004, 2008-2017 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
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.
9 
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.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _@GUARD_PREFIX@_SPAWN_H
19 
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24 
25 /* The include_next requires a split double-inclusion guard.  */
26 #if @HAVE_SPAWN_H@
27 # @INCLUDE_NEXT@ @NEXT_SPAWN_H@
28 #endif
29 
30 #ifndef _@GUARD_PREFIX@_SPAWN_H
31 #define _@GUARD_PREFIX@_SPAWN_H
32 
33 /* Get definitions of 'struct sched_param' and 'sigset_t'.
34    But avoid namespace pollution on glibc systems.  */
35 #if !(defined __GLIBC__ && !defined __UCLIBC__)
36 # include <sched.h>
37 # include <signal.h>
38 #endif
39 
40 #include <sys/types.h>
41 
42 #ifndef __THROW
43 # define __THROW
44 #endif
45 
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
50    different name.  */
51 #ifndef _Restrict_
52 # if 199901L <= __STDC_VERSION__
53 #  define _Restrict_ restrict
54 # elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
55 #  define _Restrict_ __restrict
56 # else
57 #  define _Restrict_
58 # endif
59 #endif
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            && !defined __STRICT_ANSI__))                                        \
67       && !defined __GNUG__)
68 #  define _Restrict_arr_ _Restrict_
69 # else
70 #  define _Restrict_arr_
71 # endif
72 #endif
73 
74 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
75 
76 /* The definition of _GL_ARG_NONNULL is copied here.  */
77 
78 /* The definition of _GL_WARN_ON_USE is copied here.  */
79 
80 
81 /* Data structure to contain attributes for thread creation.  */
82 #if @REPLACE_POSIX_SPAWN@
83 # define posix_spawnattr_t rpl_posix_spawnattr_t
84 #endif
85 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
86 # if !GNULIB_defined_posix_spawnattr_t
87 typedef struct
88 {
89   short int _flags;
90   pid_t _pgrp;
91   sigset_t _sd;
92   sigset_t _ss;
93   struct sched_param _sp;
94   int _policy;
95   int __pad[16];
96 } posix_spawnattr_t;
97 #  define GNULIB_defined_posix_spawnattr_t 1
98 # endif
99 #endif
100 
101 
102 /* Data structure to contain information about the actions to be
103    performed in the new process with respect to file descriptors.  */
104 #if @REPLACE_POSIX_SPAWN@
105 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
106 #endif
107 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
108 # if !GNULIB_defined_posix_spawn_file_actions_t
109 typedef struct
110 {
111   int _allocated;
112   int _used;
113   struct __spawn_action *_actions;
114   int __pad[16];
115 } posix_spawn_file_actions_t;
116 #  define GNULIB_defined_posix_spawn_file_actions_t 1
117 # endif
118 #endif
119 
120 
121 /* Flags to be set in the 'posix_spawnattr_t'.  */
122 #if @HAVE_POSIX_SPAWN@
123 /* Use the values from the system, but provide the missing ones.  */
124 # ifndef POSIX_SPAWN_SETSCHEDPARAM
125 #  define POSIX_SPAWN_SETSCHEDPARAM 0
126 # endif
127 # ifndef POSIX_SPAWN_SETSCHEDULER
128 #  define POSIX_SPAWN_SETSCHEDULER 0
129 # endif
130 #else
131 # if @REPLACE_POSIX_SPAWN@
132 /* Use the values from the system, for better compatibility.  */
133 /* But this implementation does not support AIX extensions.  */
134 #  undef POSIX_SPAWN_FORK_HANDLERS
135 # else
136 #  define POSIX_SPAWN_RESETIDS           0x01
137 #  define POSIX_SPAWN_SETPGROUP          0x02
138 #  define POSIX_SPAWN_SETSIGDEF          0x04
139 #  define POSIX_SPAWN_SETSIGMASK         0x08
140 #  define POSIX_SPAWN_SETSCHEDPARAM      0x10
141 #  define POSIX_SPAWN_SETSCHEDULER       0x20
142 # endif
143 #endif
144 /* A GNU extension.  Use the next free bit position.  */
145 #ifndef POSIX_SPAWN_USEVFORK
146 # define POSIX_SPAWN_USEVFORK \
147   ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1)                     \
148     | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1)                 \
149     | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1)                 \
150     | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1)               \
151     | POSIX_SPAWN_SETSCHEDPARAM                                           \
152     | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
153     | POSIX_SPAWN_SETSCHEDULER                                            \
154     | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0))  \
155    + 1)
156 #endif
157 #if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
158 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
159             [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
160                 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
161                 | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
162                & POSIX_SPAWN_USEVFORK)
163               == 0)
164              ? 1 : -1];
165 # define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1
166 #endif
167 
168 
169 #if @GNULIB_POSIX_SPAWN@
170 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
171    Before running the process perform the actions described in FILE-ACTIONS.
172 
173    This function is a possible cancellation points and therefore not
174    marked with __THROW. */
175 # if @REPLACE_POSIX_SPAWN@
176 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
177 #   define posix_spawn rpl_posix_spawn
178 #  endif
179 _GL_FUNCDECL_RPL (posix_spawn, int,
180                   (pid_t *_Restrict_ __pid,
181                    const char *_Restrict_ __path,
182                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
183                    const posix_spawnattr_t *_Restrict_ __attrp,
184                    char *const argv[_Restrict_arr_],
185                    char *const envp[_Restrict_arr_])
186                   _GL_ARG_NONNULL ((2, 5, 6)));
187 _GL_CXXALIAS_RPL (posix_spawn, int,
188                   (pid_t *_Restrict_ __pid,
189                    const char *_Restrict_ __path,
190                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
191                    const posix_spawnattr_t *_Restrict_ __attrp,
192                    char *const argv[_Restrict_arr_],
193                    char *const envp[_Restrict_arr_]));
194 # else
195 #  if !@HAVE_POSIX_SPAWN@
196 _GL_FUNCDECL_SYS (posix_spawn, int,
197                   (pid_t *_Restrict_ __pid,
198                    const char *_Restrict_ __path,
199                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
200                    const posix_spawnattr_t *_Restrict_ __attrp,
201                    char *const argv[_Restrict_arr_],
202                    char *const envp[_Restrict_arr_])
203                   _GL_ARG_NONNULL ((2, 5, 6)));
204 #  endif
205 _GL_CXXALIAS_SYS (posix_spawn, int,
206                   (pid_t *_Restrict_ __pid,
207                    const char *_Restrict_ __path,
208                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
209                    const posix_spawnattr_t *_Restrict_ __attrp,
210                    char *const argv[_Restrict_arr_],
211                    char *const envp[_Restrict_arr_]));
212 # endif
213 _GL_CXXALIASWARN (posix_spawn);
214 #elif defined GNULIB_POSIXCHECK
215 # undef posix_spawn
216 # if HAVE_RAW_DECL_POSIX_SPAWN
217 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
218                  "use gnulib module posix_spawn for portability");
219 # endif
220 #endif
221 
222 #if @GNULIB_POSIX_SPAWNP@
223 /* Similar to 'posix_spawn' but search for FILE in the PATH.
224 
225    This function is a possible cancellation points and therefore not
226    marked with __THROW.  */
227 # if @REPLACE_POSIX_SPAWN@
228 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
229 #   define posix_spawnp rpl_posix_spawnp
230 #  endif
231 _GL_FUNCDECL_RPL (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)));
237 _GL_CXXALIAS_RPL (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[]));
242 # else
243 #  if !@HAVE_POSIX_SPAWN@
244 _GL_FUNCDECL_SYS (posix_spawnp, int,
245                   (pid_t *__pid, const char *__file,
246                    const posix_spawn_file_actions_t *__file_actions,
247                    const posix_spawnattr_t *__attrp,
248                    char *const argv[], char *const envp[])
249                   _GL_ARG_NONNULL ((2, 5, 6)));
250 #  endif
251 _GL_CXXALIAS_SYS (posix_spawnp, int,
252                   (pid_t *__pid, const char *__file,
253                    const posix_spawn_file_actions_t *__file_actions,
254                    const posix_spawnattr_t *__attrp,
255                    char *const argv[], char *const envp[]));
256 # endif
257 _GL_CXXALIASWARN (posix_spawnp);
258 #elif defined GNULIB_POSIXCHECK
259 # undef posix_spawnp
260 # if HAVE_RAW_DECL_POSIX_SPAWNP
261 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
262                  "use gnulib module posix_spawnp for portability");
263 # endif
264 #endif
265 
266 
267 #if @GNULIB_POSIX_SPAWNATTR_INIT@
268 /* Initialize data structure with attributes for 'spawn' to default values.  */
269 # if @REPLACE_POSIX_SPAWN@
270 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
271 #   define posix_spawnattr_init rpl_posix_spawnattr_init
272 #  endif
273 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
274                                              __THROW _GL_ARG_NONNULL ((1)));
275 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
276 # else
277 #  if !@HAVE_POSIX_SPAWN@
278 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
279                                              __THROW _GL_ARG_NONNULL ((1)));
280 #  endif
281 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
282 # endif
283 _GL_CXXALIASWARN (posix_spawnattr_init);
284 #elif defined GNULIB_POSIXCHECK
285 # undef posix_spawnattr_init
286 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
287 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
288                  "use gnulib module posix_spawnattr_init for portability");
289 # endif
290 #endif
291 
292 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
293 /* Free resources associated with ATTR.  */
294 # if @REPLACE_POSIX_SPAWN@
295 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
296 #   define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
297 #  endif
298 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
299                                                 __THROW _GL_ARG_NONNULL ((1)));
300 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
301 # else
302 #  if !@HAVE_POSIX_SPAWN@
303 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
304                                                 __THROW _GL_ARG_NONNULL ((1)));
305 #  endif
306 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
307 # endif
308 _GL_CXXALIASWARN (posix_spawnattr_destroy);
309 #elif defined GNULIB_POSIXCHECK
310 # undef posix_spawnattr_destroy
311 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
312 _GL_WARN_ON_USE (posix_spawnattr_destroy,
313                  "posix_spawnattr_destroy is unportable - "
314                  "use gnulib module posix_spawnattr_destroy for portability");
315 # endif
316 #endif
317 
318 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
319 /* Store signal mask for signals with default handling from ATTR in
320    SIGDEFAULT.  */
321 # if @REPLACE_POSIX_SPAWN@
322 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
323 #   define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
324 #  endif
325 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
326                   (const posix_spawnattr_t *_Restrict_ __attr,
327                    sigset_t *_Restrict_ __sigdefault)
328                   __THROW _GL_ARG_NONNULL ((1, 2)));
329 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
330                   (const posix_spawnattr_t *_Restrict_ __attr,
331                    sigset_t *_Restrict_ __sigdefault));
332 # else
333 #  if !@HAVE_POSIX_SPAWN@
334 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
335                   (const posix_spawnattr_t *_Restrict_ __attr,
336                    sigset_t *_Restrict_ __sigdefault)
337                   __THROW _GL_ARG_NONNULL ((1, 2)));
338 #  endif
339 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
340                   (const posix_spawnattr_t *_Restrict_ __attr,
341                    sigset_t *_Restrict_ __sigdefault));
342 # endif
343 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
344 #elif defined GNULIB_POSIXCHECK
345 # undef posix_spawnattr_getsigdefault
346 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
347 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
348                  "posix_spawnattr_getsigdefault is unportable - "
349                  "use gnulib module posix_spawnattr_getsigdefault for portability");
350 # endif
351 #endif
352 
353 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
354 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT.  */
355 # if @REPLACE_POSIX_SPAWN@
356 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
357 #   define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
358 #  endif
359 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
360                   (posix_spawnattr_t *_Restrict_ __attr,
361                    const sigset_t *_Restrict_ __sigdefault)
362                   __THROW _GL_ARG_NONNULL ((1, 2)));
363 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
364                   (posix_spawnattr_t *_Restrict_ __attr,
365                    const sigset_t *_Restrict_ __sigdefault));
366 # else
367 #  if !@HAVE_POSIX_SPAWN@
368 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
369                   (posix_spawnattr_t *_Restrict_ __attr,
370                    const sigset_t *_Restrict_ __sigdefault)
371                   __THROW _GL_ARG_NONNULL ((1, 2)));
372 #  endif
373 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
374                   (posix_spawnattr_t *_Restrict_ __attr,
375                    const sigset_t *_Restrict_ __sigdefault));
376 # endif
377 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
378 #elif defined GNULIB_POSIXCHECK
379 # undef posix_spawnattr_setsigdefault
380 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
381 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
382                  "posix_spawnattr_setsigdefault is unportable - "
383                  "use gnulib module posix_spawnattr_setsigdefault for portability");
384 # endif
385 #endif
386 
387 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
388 /* Store signal mask for the new process from ATTR in SIGMASK.  */
389 # if @REPLACE_POSIX_SPAWN@
390 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
391 #   define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
392 #  endif
393 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
394                   (const posix_spawnattr_t *_Restrict_ __attr,
395                    sigset_t *_Restrict_ __sigmask)
396                   __THROW _GL_ARG_NONNULL ((1, 2)));
397 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
398                   (const posix_spawnattr_t *_Restrict_ __attr,
399                    sigset_t *_Restrict_ __sigmask));
400 # else
401 #  if !@HAVE_POSIX_SPAWN@
402 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
403                   (const posix_spawnattr_t *_Restrict_ __attr,
404                    sigset_t *_Restrict_ __sigmask)
405                   __THROW _GL_ARG_NONNULL ((1, 2)));
406 #  endif
407 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
408                   (const posix_spawnattr_t *_Restrict_ __attr,
409                    sigset_t *_Restrict_ __sigmask));
410 # endif
411 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
412 #elif defined GNULIB_POSIXCHECK
413 # undef posix_spawnattr_getsigmask
414 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
415 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
416                  "posix_spawnattr_getsigmask is unportable - "
417                  "use gnulib module posix_spawnattr_getsigmask for portability");
418 # endif
419 #endif
420 
421 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
422 /* Set signal mask for the new process in ATTR to SIGMASK.  */
423 # if @REPLACE_POSIX_SPAWN@
424 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
425 #   define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
426 #  endif
427 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
428                   (posix_spawnattr_t *_Restrict_ __attr,
429                    const sigset_t *_Restrict_ __sigmask)
430                   __THROW _GL_ARG_NONNULL ((1, 2)));
431 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
432                   (posix_spawnattr_t *_Restrict_ __attr,
433                    const sigset_t *_Restrict_ __sigmask));
434 # else
435 #  if !@HAVE_POSIX_SPAWN@
436 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
437                   (posix_spawnattr_t *_Restrict_ __attr,
438                    const sigset_t *_Restrict_ __sigmask)
439                   __THROW _GL_ARG_NONNULL ((1, 2)));
440 #  endif
441 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
442                   (posix_spawnattr_t *_Restrict_ __attr,
443                    const sigset_t *_Restrict_ __sigmask));
444 # endif
445 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
446 #elif defined GNULIB_POSIXCHECK
447 # undef posix_spawnattr_setsigmask
448 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
449 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
450                  "posix_spawnattr_setsigmask is unportable - "
451                  "use gnulib module posix_spawnattr_setsigmask for portability");
452 # endif
453 #endif
454 
455 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
456 /* Get flag word from the attribute structure.  */
457 # if @REPLACE_POSIX_SPAWN@
458 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
459 #   define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
460 #  endif
461 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
462                   (const posix_spawnattr_t *_Restrict_ __attr,
463                    short int *_Restrict_ __flags)
464                   __THROW _GL_ARG_NONNULL ((1, 2)));
465 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
466                   (const posix_spawnattr_t *_Restrict_ __attr,
467                    short int *_Restrict_ __flags));
468 # else
469 #  if !@HAVE_POSIX_SPAWN@
470 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
471                   (const posix_spawnattr_t *_Restrict_ __attr,
472                    short int *_Restrict_ __flags)
473                   __THROW _GL_ARG_NONNULL ((1, 2)));
474 #  endif
475 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
476                   (const posix_spawnattr_t *_Restrict_ __attr,
477                    short int *_Restrict_ __flags));
478 # endif
479 _GL_CXXALIASWARN (posix_spawnattr_getflags);
480 #elif defined GNULIB_POSIXCHECK
481 # undef posix_spawnattr_getflags
482 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
483 _GL_WARN_ON_USE (posix_spawnattr_getflags,
484                  "posix_spawnattr_getflags is unportable - "
485                  "use gnulib module posix_spawnattr_getflags for portability");
486 # endif
487 #endif
488 
489 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
490 /* Store flags in the attribute structure.  */
491 # if @REPLACE_POSIX_SPAWN@
492 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
493 #   define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
494 #  endif
495 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
496                   (posix_spawnattr_t *__attr, short int __flags)
497                   __THROW _GL_ARG_NONNULL ((1)));
498 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
499                   (posix_spawnattr_t *__attr, short int __flags));
500 # else
501 #  if !@HAVE_POSIX_SPAWN@
502 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
503                   (posix_spawnattr_t *__attr, short int __flags)
504                   __THROW _GL_ARG_NONNULL ((1)));
505 #  endif
506 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
507                   (posix_spawnattr_t *__attr, short int __flags));
508 # endif
509 _GL_CXXALIASWARN (posix_spawnattr_setflags);
510 #elif defined GNULIB_POSIXCHECK
511 # undef posix_spawnattr_setflags
512 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
513 _GL_WARN_ON_USE (posix_spawnattr_setflags,
514                  "posix_spawnattr_setflags is unportable - "
515                  "use gnulib module posix_spawnattr_setflags for portability");
516 # endif
517 #endif
518 
519 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
520 /* Get process group ID from the attribute structure.  */
521 # if @REPLACE_POSIX_SPAWN@
522 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
523 #   define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
524 #  endif
525 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
526                   (const posix_spawnattr_t *_Restrict_ __attr,
527                    pid_t *_Restrict_ __pgroup)
528                   __THROW _GL_ARG_NONNULL ((1, 2)));
529 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
530                   (const posix_spawnattr_t *_Restrict_ __attr,
531                    pid_t *_Restrict_ __pgroup));
532 # else
533 #  if !@HAVE_POSIX_SPAWN@
534 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
535                   (const posix_spawnattr_t *_Restrict_ __attr,
536                    pid_t *_Restrict_ __pgroup)
537                   __THROW _GL_ARG_NONNULL ((1, 2)));
538 #  endif
539 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
540                   (const posix_spawnattr_t *_Restrict_ __attr,
541                    pid_t *_Restrict_ __pgroup));
542 # endif
543 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
544 #elif defined GNULIB_POSIXCHECK
545 # undef posix_spawnattr_getpgroup
546 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
547 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
548                  "posix_spawnattr_getpgroup is unportable - "
549                  "use gnulib module posix_spawnattr_getpgroup for portability");
550 # endif
551 #endif
552 
553 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
554 /* Store process group ID in the attribute structure.  */
555 # if @REPLACE_POSIX_SPAWN@
556 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
557 #   define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
558 #  endif
559 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
560                   (posix_spawnattr_t *__attr, pid_t __pgroup)
561                   __THROW _GL_ARG_NONNULL ((1)));
562 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
563                   (posix_spawnattr_t *__attr, pid_t __pgroup));
564 # else
565 #  if !@HAVE_POSIX_SPAWN@
566 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
567                   (posix_spawnattr_t *__attr, pid_t __pgroup)
568                   __THROW _GL_ARG_NONNULL ((1)));
569 #  endif
570 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
571                   (posix_spawnattr_t *__attr, pid_t __pgroup));
572 # endif
573 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
574 #elif defined GNULIB_POSIXCHECK
575 # undef posix_spawnattr_setpgroup
576 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
577 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
578                  "posix_spawnattr_setpgroup is unportable - "
579                  "use gnulib module posix_spawnattr_setpgroup for portability");
580 # endif
581 #endif
582 
583 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
584 /* Get scheduling policy from the attribute structure.  */
585 # if @REPLACE_POSIX_SPAWN@
586 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
587 #   define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
588 #  endif
589 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
590                   (const posix_spawnattr_t *_Restrict_ __attr,
591                    int *_Restrict_ __schedpolicy)
592                   __THROW _GL_ARG_NONNULL ((1, 2)));
593 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
594                   (const posix_spawnattr_t *_Restrict_ __attr,
595                    int *_Restrict_ __schedpolicy));
596 # else
597 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
598 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
599                   (const posix_spawnattr_t *_Restrict_ __attr,
600                    int *_Restrict_ __schedpolicy)
601                   __THROW _GL_ARG_NONNULL ((1, 2)));
602 #  endif
603 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
604                   (const posix_spawnattr_t *_Restrict_ __attr,
605                    int *_Restrict_ __schedpolicy));
606 # endif
607 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
608 #elif defined GNULIB_POSIXCHECK
609 # undef posix_spawnattr_getschedpolicy
610 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
611 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
612                  "posix_spawnattr_getschedpolicy is unportable - "
613                  "use gnulib module posix_spawnattr_getschedpolicy for portability");
614 # endif
615 #endif
616 
617 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
618 /* Store scheduling policy in the attribute structure.  */
619 # if @REPLACE_POSIX_SPAWN@
620 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
621 #   define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
622 #  endif
623 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
624                   (posix_spawnattr_t *__attr, int __schedpolicy)
625                   __THROW _GL_ARG_NONNULL ((1)));
626 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
627                   (posix_spawnattr_t *__attr, int __schedpolicy));
628 # else
629 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
630 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
631                   (posix_spawnattr_t *__attr, int __schedpolicy)
632                   __THROW _GL_ARG_NONNULL ((1)));
633 #  endif
634 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
635                   (posix_spawnattr_t *__attr, int __schedpolicy));
636 # endif
637 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
638 #elif defined GNULIB_POSIXCHECK
639 # undef posix_spawnattr_setschedpolicy
640 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
641 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
642                  "posix_spawnattr_setschedpolicy is unportable - "
643                  "use gnulib module posix_spawnattr_setschedpolicy for portability");
644 # endif
645 #endif
646 
647 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
648 /* Get scheduling parameters from the attribute structure.  */
649 # if @REPLACE_POSIX_SPAWN@
650 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
651 #   define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
652 #  endif
653 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
654                   (const posix_spawnattr_t *_Restrict_ __attr,
655                    struct sched_param *_Restrict_ __schedparam)
656                   __THROW _GL_ARG_NONNULL ((1, 2)));
657 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
658                   (const posix_spawnattr_t *_Restrict_ __attr,
659                    struct sched_param *_Restrict_ __schedparam));
660 # else
661 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
662 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
663                   (const posix_spawnattr_t *_Restrict_ __attr,
664                    struct sched_param *_Restrict_ __schedparam)
665                   __THROW _GL_ARG_NONNULL ((1, 2)));
666 #  endif
667 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
668                   (const posix_spawnattr_t *_Restrict_ __attr,
669                    struct sched_param *_Restrict_ __schedparam));
670 # endif
671 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
672 #elif defined GNULIB_POSIXCHECK
673 # undef posix_spawnattr_getschedparam
674 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
675 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
676                  "posix_spawnattr_getschedparam is unportable - "
677                  "use gnulib module posix_spawnattr_getschedparam for portability");
678 # endif
679 #endif
680 
681 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
682 /* Store scheduling parameters in the attribute structure.  */
683 # if @REPLACE_POSIX_SPAWN@
684 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
685 #   define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
686 #  endif
687 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
688                   (posix_spawnattr_t *_Restrict_ __attr,
689                    const struct sched_param *_Restrict_ __schedparam)
690                   __THROW _GL_ARG_NONNULL ((1, 2)));
691 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
692                   (posix_spawnattr_t *_Restrict_ __attr,
693                    const struct sched_param *_Restrict_ __schedparam));
694 # else
695 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
696 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
697                   (posix_spawnattr_t *_Restrict_ __attr,
698                    const struct sched_param *_Restrict_ __schedparam)
699                   __THROW _GL_ARG_NONNULL ((1, 2)));
700 #  endif
701 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
702                   (posix_spawnattr_t *_Restrict_ __attr,
703                    const struct sched_param *_Restrict_ __schedparam));
704 # endif
705 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
706 #elif defined GNULIB_POSIXCHECK
707 # undef posix_spawnattr_setschedparam
708 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
709 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
710                  "posix_spawnattr_setschedparam is unportable - "
711                  "use gnulib module posix_spawnattr_setschedparam for portability");
712 # endif
713 #endif
714 
715 
716 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
717 /* Initialize data structure for file attribute for 'spawn' call.  */
718 # if @REPLACE_POSIX_SPAWN@
719 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
720 #   define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
721 #  endif
722 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
723                   (posix_spawn_file_actions_t *__file_actions)
724                   __THROW _GL_ARG_NONNULL ((1)));
725 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
726                   (posix_spawn_file_actions_t *__file_actions));
727 # else
728 #  if !@HAVE_POSIX_SPAWN@
729 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
730                   (posix_spawn_file_actions_t *__file_actions)
731                   __THROW _GL_ARG_NONNULL ((1)));
732 #  endif
733 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
734                   (posix_spawn_file_actions_t *__file_actions));
735 # endif
736 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
737 #elif defined GNULIB_POSIXCHECK
738 # undef posix_spawn_file_actions_init
739 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
740 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
741                  "posix_spawn_file_actions_init is unportable - "
742                  "use gnulib module posix_spawn_file_actions_init for portability");
743 # endif
744 #endif
745 
746 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
747 /* Free resources associated with FILE-ACTIONS.  */
748 # if @REPLACE_POSIX_SPAWN@
749 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
750 #   define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
751 #  endif
752 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
753                   (posix_spawn_file_actions_t *__file_actions)
754                   __THROW _GL_ARG_NONNULL ((1)));
755 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
756                   (posix_spawn_file_actions_t *__file_actions));
757 # else
758 #  if !@HAVE_POSIX_SPAWN@
759 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
760                   (posix_spawn_file_actions_t *__file_actions)
761                   __THROW _GL_ARG_NONNULL ((1)));
762 #  endif
763 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
764                   (posix_spawn_file_actions_t *__file_actions));
765 # endif
766 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
767 #elif defined GNULIB_POSIXCHECK
768 # undef posix_spawn_file_actions_destroy
769 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
770 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
771                  "posix_spawn_file_actions_destroy is unportable - "
772                  "use gnulib module posix_spawn_file_actions_destroy for portability");
773 # endif
774 #endif
775 
776 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
777 /* Add an action to FILE-ACTIONS which tells the implementation to call
778    'open' for the given file during the 'spawn' call.  */
779 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
780 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781 #   define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
782 #  endif
783 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
784                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
785                    int __fd,
786                    const char *_Restrict_ __path, int __oflag, mode_t __mode)
787                   __THROW _GL_ARG_NONNULL ((1, 3)));
788 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
789                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
790                    int __fd,
791                    const char *_Restrict_ __path, int __oflag, mode_t __mode));
792 # else
793 #  if !@HAVE_POSIX_SPAWN@
794 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
795                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
796                    int __fd,
797                    const char *_Restrict_ __path, int __oflag, mode_t __mode)
798                   __THROW _GL_ARG_NONNULL ((1, 3)));
799 #  endif
800 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
801                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
802                    int __fd,
803                    const char *_Restrict_ __path, int __oflag, mode_t __mode));
804 # endif
805 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
806 #elif defined GNULIB_POSIXCHECK
807 # undef posix_spawn_file_actions_addopen
808 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
809 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
810                  "posix_spawn_file_actions_addopen is unportable - "
811                  "use gnulib module posix_spawn_file_actions_addopen for portability");
812 # endif
813 #endif
814 
815 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
816 /* Add an action to FILE-ACTIONS which tells the implementation to call
817    'close' for the given file descriptor during the 'spawn' call.  */
818 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
819 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
820 #   define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
821 #  endif
822 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
823                   (posix_spawn_file_actions_t *__file_actions, int __fd)
824                   __THROW _GL_ARG_NONNULL ((1)));
825 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
826                   (posix_spawn_file_actions_t *__file_actions, int __fd));
827 # else
828 #  if !@HAVE_POSIX_SPAWN@
829 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
830                   (posix_spawn_file_actions_t *__file_actions, int __fd)
831                   __THROW _GL_ARG_NONNULL ((1)));
832 #  endif
833 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
834                   (posix_spawn_file_actions_t *__file_actions, int __fd));
835 # endif
836 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
837 #elif defined GNULIB_POSIXCHECK
838 # undef posix_spawn_file_actions_addclose
839 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
840 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
841                  "posix_spawn_file_actions_addclose is unportable - "
842                  "use gnulib module posix_spawn_file_actions_addclose for portability");
843 # endif
844 #endif
845 
846 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
847 /* Add an action to FILE-ACTIONS which tells the implementation to call
848    'dup2' for the given file descriptors during the 'spawn' call.  */
849 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
850 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
851 #   define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
852 #  endif
853 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
854                   (posix_spawn_file_actions_t *__file_actions,
855                    int __fd, int __newfd)
856                   __THROW _GL_ARG_NONNULL ((1)));
857 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
858                   (posix_spawn_file_actions_t *__file_actions,
859                    int __fd, int __newfd));
860 # else
861 #  if !@HAVE_POSIX_SPAWN@
862 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
863                   (posix_spawn_file_actions_t *__file_actions,
864                    int __fd, int __newfd)
865                   __THROW _GL_ARG_NONNULL ((1)));
866 #  endif
867 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
868                   (posix_spawn_file_actions_t *__file_actions,
869                    int __fd, int __newfd));
870 # endif
871 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
872 #elif defined GNULIB_POSIXCHECK
873 # undef posix_spawn_file_actions_adddup2
874 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
875 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
876                  "posix_spawn_file_actions_adddup2 is unportable - "
877                  "use gnulib module posix_spawn_file_actions_adddup2 for portability");
878 # endif
879 #endif
880 
881 
882 #endif /* _@GUARD_PREFIX@_SPAWN_H */
883 #endif /* _@GUARD_PREFIX@_SPAWN_H */
884