• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Definitions for POSIX spawn interface.
2    Copyright (C) 2000, 2003-2004, 2008-2012 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 <http://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 #define POSIX_SPAWN_USEVFORK \
146   ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1)                     \
147     | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1)                 \
148     | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1)                 \
149     | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1)               \
150     | POSIX_SPAWN_SETSCHEDPARAM                                           \
151     | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
152     | POSIX_SPAWN_SETSCHEDULER                                            \
153     | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0))  \
154    + 1)
155 #if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
156 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
157             [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
158                 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
159                 | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
160                & POSIX_SPAWN_USEVFORK)
161               == 0)
162              ? 1 : -1];
163 # define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1
164 #endif
165 
166 
167 #if @GNULIB_POSIX_SPAWN@
168 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
169    Before running the process perform the actions described in FILE-ACTIONS.
170 
171    This function is a possible cancellation points and therefore not
172    marked with __THROW. */
173 # if @REPLACE_POSIX_SPAWN@
174 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175 #   define posix_spawn rpl_posix_spawn
176 #  endif
177 _GL_FUNCDECL_RPL (posix_spawn, int,
178                   (pid_t *_Restrict_ __pid,
179                    const char *_Restrict_ __path,
180                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
181                    const posix_spawnattr_t *_Restrict_ __attrp,
182                    char *const argv[_Restrict_arr_],
183                    char *const envp[_Restrict_arr_])
184                   _GL_ARG_NONNULL ((2, 5, 6)));
185 _GL_CXXALIAS_RPL (posix_spawn, int,
186                   (pid_t *_Restrict_ __pid,
187                    const char *_Restrict_ __path,
188                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
189                    const posix_spawnattr_t *_Restrict_ __attrp,
190                    char *const argv[_Restrict_arr_],
191                    char *const envp[_Restrict_arr_]));
192 # else
193 #  if !@HAVE_POSIX_SPAWN@
194 _GL_FUNCDECL_SYS (posix_spawn, int,
195                   (pid_t *_Restrict_ __pid,
196                    const char *_Restrict_ __path,
197                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
198                    const posix_spawnattr_t *_Restrict_ __attrp,
199                    char *const argv[_Restrict_arr_],
200                    char *const envp[_Restrict_arr_])
201                   _GL_ARG_NONNULL ((2, 5, 6)));
202 #  endif
203 _GL_CXXALIAS_SYS (posix_spawn, int,
204                   (pid_t *_Restrict_ __pid,
205                    const char *_Restrict_ __path,
206                    const posix_spawn_file_actions_t *_Restrict_ __file_actions,
207                    const posix_spawnattr_t *_Restrict_ __attrp,
208                    char *const argv[_Restrict_arr_],
209                    char *const envp[_Restrict_arr_]));
210 # endif
211 _GL_CXXALIASWARN (posix_spawn);
212 #elif defined GNULIB_POSIXCHECK
213 # undef posix_spawn
214 # if HAVE_RAW_DECL_POSIX_SPAWN
215 _GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
216                  "use gnulib module posix_spawn for portability");
217 # endif
218 #endif
219 
220 #if @GNULIB_POSIX_SPAWNP@
221 /* Similar to 'posix_spawn' but search for FILE in the PATH.
222 
223    This function is a possible cancellation points and therefore not
224    marked with __THROW.  */
225 # if @REPLACE_POSIX_SPAWN@
226 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
227 #   define posix_spawnp rpl_posix_spawnp
228 #  endif
229 _GL_FUNCDECL_RPL (posix_spawnp, int,
230                   (pid_t *__pid, const char *__file,
231                    const posix_spawn_file_actions_t *__file_actions,
232                    const posix_spawnattr_t *__attrp,
233                    char *const argv[], char *const envp[])
234                   _GL_ARG_NONNULL ((2, 5, 6)));
235 _GL_CXXALIAS_RPL (posix_spawnp, int,
236                   (pid_t *__pid, const char *__file,
237                    const posix_spawn_file_actions_t *__file_actions,
238                    const posix_spawnattr_t *__attrp,
239                    char *const argv[], char *const envp[]));
240 # else
241 #  if !@HAVE_POSIX_SPAWN@
242 _GL_FUNCDECL_SYS (posix_spawnp, int,
243                   (pid_t *__pid, const char *__file,
244                    const posix_spawn_file_actions_t *__file_actions,
245                    const posix_spawnattr_t *__attrp,
246                    char *const argv[], char *const envp[])
247                   _GL_ARG_NONNULL ((2, 5, 6)));
248 #  endif
249 _GL_CXXALIAS_SYS (posix_spawnp, int,
250                   (pid_t *__pid, const char *__file,
251                    const posix_spawn_file_actions_t *__file_actions,
252                    const posix_spawnattr_t *__attrp,
253                    char *const argv[], char *const envp[]));
254 # endif
255 _GL_CXXALIASWARN (posix_spawnp);
256 #elif defined GNULIB_POSIXCHECK
257 # undef posix_spawnp
258 # if HAVE_RAW_DECL_POSIX_SPAWNP
259 _GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
260                  "use gnulib module posix_spawnp for portability");
261 # endif
262 #endif
263 
264 
265 #if @GNULIB_POSIX_SPAWNATTR_INIT@
266 /* Initialize data structure with attributes for 'spawn' to default values.  */
267 # if @REPLACE_POSIX_SPAWN@
268 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
269 #   define posix_spawnattr_init rpl_posix_spawnattr_init
270 #  endif
271 _GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
272                                              __THROW _GL_ARG_NONNULL ((1)));
273 _GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
274 # else
275 #  if !@HAVE_POSIX_SPAWN@
276 _GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
277                                              __THROW _GL_ARG_NONNULL ((1)));
278 #  endif
279 _GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
280 # endif
281 _GL_CXXALIASWARN (posix_spawnattr_init);
282 #elif defined GNULIB_POSIXCHECK
283 # undef posix_spawnattr_init
284 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
285 _GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
286                  "use gnulib module posix_spawnattr_init for portability");
287 # endif
288 #endif
289 
290 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
291 /* Free resources associated with ATTR.  */
292 # if @REPLACE_POSIX_SPAWN@
293 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
294 #   define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
295 #  endif
296 _GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
297                                                 __THROW _GL_ARG_NONNULL ((1)));
298 _GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
299 # else
300 #  if !@HAVE_POSIX_SPAWN@
301 _GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
302                                                 __THROW _GL_ARG_NONNULL ((1)));
303 #  endif
304 _GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
305 # endif
306 _GL_CXXALIASWARN (posix_spawnattr_destroy);
307 #elif defined GNULIB_POSIXCHECK
308 # undef posix_spawnattr_destroy
309 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
310 _GL_WARN_ON_USE (posix_spawnattr_destroy,
311                  "posix_spawnattr_destroy is unportable - "
312                  "use gnulib module posix_spawnattr_destroy for portability");
313 # endif
314 #endif
315 
316 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
317 /* Store signal mask for signals with default handling from ATTR in
318    SIGDEFAULT.  */
319 # if @REPLACE_POSIX_SPAWN@
320 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
321 #   define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
322 #  endif
323 _GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
324                   (const posix_spawnattr_t *_Restrict_ __attr,
325                    sigset_t *_Restrict_ __sigdefault)
326                   __THROW _GL_ARG_NONNULL ((1, 2)));
327 _GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
328                   (const posix_spawnattr_t *_Restrict_ __attr,
329                    sigset_t *_Restrict_ __sigdefault));
330 # else
331 #  if !@HAVE_POSIX_SPAWN@
332 _GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
333                   (const posix_spawnattr_t *_Restrict_ __attr,
334                    sigset_t *_Restrict_ __sigdefault)
335                   __THROW _GL_ARG_NONNULL ((1, 2)));
336 #  endif
337 _GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
338                   (const posix_spawnattr_t *_Restrict_ __attr,
339                    sigset_t *_Restrict_ __sigdefault));
340 # endif
341 _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
342 #elif defined GNULIB_POSIXCHECK
343 # undef posix_spawnattr_getsigdefault
344 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
345 _GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
346                  "posix_spawnattr_getsigdefault is unportable - "
347                  "use gnulib module posix_spawnattr_getsigdefault for portability");
348 # endif
349 #endif
350 
351 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
352 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT.  */
353 # if @REPLACE_POSIX_SPAWN@
354 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
355 #   define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
356 #  endif
357 _GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
358                   (posix_spawnattr_t *_Restrict_ __attr,
359                    const sigset_t *_Restrict_ __sigdefault)
360                   __THROW _GL_ARG_NONNULL ((1, 2)));
361 _GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
362                   (posix_spawnattr_t *_Restrict_ __attr,
363                    const sigset_t *_Restrict_ __sigdefault));
364 # else
365 #  if !@HAVE_POSIX_SPAWN@
366 _GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
367                   (posix_spawnattr_t *_Restrict_ __attr,
368                    const sigset_t *_Restrict_ __sigdefault)
369                   __THROW _GL_ARG_NONNULL ((1, 2)));
370 #  endif
371 _GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
372                   (posix_spawnattr_t *_Restrict_ __attr,
373                    const sigset_t *_Restrict_ __sigdefault));
374 # endif
375 _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
376 #elif defined GNULIB_POSIXCHECK
377 # undef posix_spawnattr_setsigdefault
378 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
379 _GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
380                  "posix_spawnattr_setsigdefault is unportable - "
381                  "use gnulib module posix_spawnattr_setsigdefault for portability");
382 # endif
383 #endif
384 
385 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
386 /* Store signal mask for the new process from ATTR in SIGMASK.  */
387 # if @REPLACE_POSIX_SPAWN@
388 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
389 #   define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
390 #  endif
391 _GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
392                   (const posix_spawnattr_t *_Restrict_ __attr,
393                    sigset_t *_Restrict_ __sigmask)
394                   __THROW _GL_ARG_NONNULL ((1, 2)));
395 _GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
396                   (const posix_spawnattr_t *_Restrict_ __attr,
397                    sigset_t *_Restrict_ __sigmask));
398 # else
399 #  if !@HAVE_POSIX_SPAWN@
400 _GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
401                   (const posix_spawnattr_t *_Restrict_ __attr,
402                    sigset_t *_Restrict_ __sigmask)
403                   __THROW _GL_ARG_NONNULL ((1, 2)));
404 #  endif
405 _GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
406                   (const posix_spawnattr_t *_Restrict_ __attr,
407                    sigset_t *_Restrict_ __sigmask));
408 # endif
409 _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
410 #elif defined GNULIB_POSIXCHECK
411 # undef posix_spawnattr_getsigmask
412 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
413 _GL_WARN_ON_USE (posix_spawnattr_getsigmask,
414                  "posix_spawnattr_getsigmask is unportable - "
415                  "use gnulib module posix_spawnattr_getsigmask for portability");
416 # endif
417 #endif
418 
419 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
420 /* Set signal mask for the new process in ATTR to SIGMASK.  */
421 # if @REPLACE_POSIX_SPAWN@
422 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
423 #   define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
424 #  endif
425 _GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
426                   (posix_spawnattr_t *_Restrict_ __attr,
427                    const sigset_t *_Restrict_ __sigmask)
428                   __THROW _GL_ARG_NONNULL ((1, 2)));
429 _GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
430                   (posix_spawnattr_t *_Restrict_ __attr,
431                    const sigset_t *_Restrict_ __sigmask));
432 # else
433 #  if !@HAVE_POSIX_SPAWN@
434 _GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
435                   (posix_spawnattr_t *_Restrict_ __attr,
436                    const sigset_t *_Restrict_ __sigmask)
437                   __THROW _GL_ARG_NONNULL ((1, 2)));
438 #  endif
439 _GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
440                   (posix_spawnattr_t *_Restrict_ __attr,
441                    const sigset_t *_Restrict_ __sigmask));
442 # endif
443 _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
444 #elif defined GNULIB_POSIXCHECK
445 # undef posix_spawnattr_setsigmask
446 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
447 _GL_WARN_ON_USE (posix_spawnattr_setsigmask,
448                  "posix_spawnattr_setsigmask is unportable - "
449                  "use gnulib module posix_spawnattr_setsigmask for portability");
450 # endif
451 #endif
452 
453 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
454 /* Get flag word from the attribute structure.  */
455 # if @REPLACE_POSIX_SPAWN@
456 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
457 #   define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
458 #  endif
459 _GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
460                   (const posix_spawnattr_t *_Restrict_ __attr,
461                    short int *_Restrict_ __flags)
462                   __THROW _GL_ARG_NONNULL ((1, 2)));
463 _GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
464                   (const posix_spawnattr_t *_Restrict_ __attr,
465                    short int *_Restrict_ __flags));
466 # else
467 #  if !@HAVE_POSIX_SPAWN@
468 _GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
469                   (const posix_spawnattr_t *_Restrict_ __attr,
470                    short int *_Restrict_ __flags)
471                   __THROW _GL_ARG_NONNULL ((1, 2)));
472 #  endif
473 _GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
474                   (const posix_spawnattr_t *_Restrict_ __attr,
475                    short int *_Restrict_ __flags));
476 # endif
477 _GL_CXXALIASWARN (posix_spawnattr_getflags);
478 #elif defined GNULIB_POSIXCHECK
479 # undef posix_spawnattr_getflags
480 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
481 _GL_WARN_ON_USE (posix_spawnattr_getflags,
482                  "posix_spawnattr_getflags is unportable - "
483                  "use gnulib module posix_spawnattr_getflags for portability");
484 # endif
485 #endif
486 
487 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
488 /* Store flags in the attribute structure.  */
489 # if @REPLACE_POSIX_SPAWN@
490 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
491 #   define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
492 #  endif
493 _GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
494                   (posix_spawnattr_t *__attr, short int __flags)
495                   __THROW _GL_ARG_NONNULL ((1)));
496 _GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
497                   (posix_spawnattr_t *__attr, short int __flags));
498 # else
499 #  if !@HAVE_POSIX_SPAWN@
500 _GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
501                   (posix_spawnattr_t *__attr, short int __flags)
502                   __THROW _GL_ARG_NONNULL ((1)));
503 #  endif
504 _GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
505                   (posix_spawnattr_t *__attr, short int __flags));
506 # endif
507 _GL_CXXALIASWARN (posix_spawnattr_setflags);
508 #elif defined GNULIB_POSIXCHECK
509 # undef posix_spawnattr_setflags
510 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
511 _GL_WARN_ON_USE (posix_spawnattr_setflags,
512                  "posix_spawnattr_setflags is unportable - "
513                  "use gnulib module posix_spawnattr_setflags for portability");
514 # endif
515 #endif
516 
517 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
518 /* Get process group ID from the attribute structure.  */
519 # if @REPLACE_POSIX_SPAWN@
520 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
521 #   define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
522 #  endif
523 _GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
524                   (const posix_spawnattr_t *_Restrict_ __attr,
525                    pid_t *_Restrict_ __pgroup)
526                   __THROW _GL_ARG_NONNULL ((1, 2)));
527 _GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
528                   (const posix_spawnattr_t *_Restrict_ __attr,
529                    pid_t *_Restrict_ __pgroup));
530 # else
531 #  if !@HAVE_POSIX_SPAWN@
532 _GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
533                   (const posix_spawnattr_t *_Restrict_ __attr,
534                    pid_t *_Restrict_ __pgroup)
535                   __THROW _GL_ARG_NONNULL ((1, 2)));
536 #  endif
537 _GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
538                   (const posix_spawnattr_t *_Restrict_ __attr,
539                    pid_t *_Restrict_ __pgroup));
540 # endif
541 _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
542 #elif defined GNULIB_POSIXCHECK
543 # undef posix_spawnattr_getpgroup
544 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
545 _GL_WARN_ON_USE (posix_spawnattr_getpgroup,
546                  "posix_spawnattr_getpgroup is unportable - "
547                  "use gnulib module posix_spawnattr_getpgroup for portability");
548 # endif
549 #endif
550 
551 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
552 /* Store process group ID in the attribute structure.  */
553 # if @REPLACE_POSIX_SPAWN@
554 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
555 #   define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
556 #  endif
557 _GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
558                   (posix_spawnattr_t *__attr, pid_t __pgroup)
559                   __THROW _GL_ARG_NONNULL ((1)));
560 _GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
561                   (posix_spawnattr_t *__attr, pid_t __pgroup));
562 # else
563 #  if !@HAVE_POSIX_SPAWN@
564 _GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
565                   (posix_spawnattr_t *__attr, pid_t __pgroup)
566                   __THROW _GL_ARG_NONNULL ((1)));
567 #  endif
568 _GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
569                   (posix_spawnattr_t *__attr, pid_t __pgroup));
570 # endif
571 _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
572 #elif defined GNULIB_POSIXCHECK
573 # undef posix_spawnattr_setpgroup
574 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
575 _GL_WARN_ON_USE (posix_spawnattr_setpgroup,
576                  "posix_spawnattr_setpgroup is unportable - "
577                  "use gnulib module posix_spawnattr_setpgroup for portability");
578 # endif
579 #endif
580 
581 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
582 /* Get scheduling policy from the attribute structure.  */
583 # if @REPLACE_POSIX_SPAWN@
584 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
585 #   define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
586 #  endif
587 _GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
588                   (const posix_spawnattr_t *_Restrict_ __attr,
589                    int *_Restrict_ __schedpolicy)
590                   __THROW _GL_ARG_NONNULL ((1, 2)));
591 _GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
592                   (const posix_spawnattr_t *_Restrict_ __attr,
593                    int *_Restrict_ __schedpolicy));
594 # else
595 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
596 _GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
597                   (const posix_spawnattr_t *_Restrict_ __attr,
598                    int *_Restrict_ __schedpolicy)
599                   __THROW _GL_ARG_NONNULL ((1, 2)));
600 #  endif
601 _GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
602                   (const posix_spawnattr_t *_Restrict_ __attr,
603                    int *_Restrict_ __schedpolicy));
604 # endif
605 _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
606 #elif defined GNULIB_POSIXCHECK
607 # undef posix_spawnattr_getschedpolicy
608 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
609 _GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
610                  "posix_spawnattr_getschedpolicy is unportable - "
611                  "use gnulib module posix_spawnattr_getschedpolicy for portability");
612 # endif
613 #endif
614 
615 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
616 /* Store scheduling policy in the attribute structure.  */
617 # if @REPLACE_POSIX_SPAWN@
618 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 #   define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
620 #  endif
621 _GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
622                   (posix_spawnattr_t *__attr, int __schedpolicy)
623                   __THROW _GL_ARG_NONNULL ((1)));
624 _GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
625                   (posix_spawnattr_t *__attr, int __schedpolicy));
626 # else
627 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
628 _GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
629                   (posix_spawnattr_t *__attr, int __schedpolicy)
630                   __THROW _GL_ARG_NONNULL ((1)));
631 #  endif
632 _GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
633                   (posix_spawnattr_t *__attr, int __schedpolicy));
634 # endif
635 _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
636 #elif defined GNULIB_POSIXCHECK
637 # undef posix_spawnattr_setschedpolicy
638 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
639 _GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
640                  "posix_spawnattr_setschedpolicy is unportable - "
641                  "use gnulib module posix_spawnattr_setschedpolicy for portability");
642 # endif
643 #endif
644 
645 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
646 /* Get scheduling parameters from the attribute structure.  */
647 # if @REPLACE_POSIX_SPAWN@
648 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
649 #   define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
650 #  endif
651 _GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
652                   (const posix_spawnattr_t *_Restrict_ __attr,
653                    struct sched_param *_Restrict_ __schedparam)
654                   __THROW _GL_ARG_NONNULL ((1, 2)));
655 _GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
656                   (const posix_spawnattr_t *_Restrict_ __attr,
657                    struct sched_param *_Restrict_ __schedparam));
658 # else
659 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
660 _GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
661                   (const posix_spawnattr_t *_Restrict_ __attr,
662                    struct sched_param *_Restrict_ __schedparam)
663                   __THROW _GL_ARG_NONNULL ((1, 2)));
664 #  endif
665 _GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
666                   (const posix_spawnattr_t *_Restrict_ __attr,
667                    struct sched_param *_Restrict_ __schedparam));
668 # endif
669 _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
670 #elif defined GNULIB_POSIXCHECK
671 # undef posix_spawnattr_getschedparam
672 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
673 _GL_WARN_ON_USE (posix_spawnattr_getschedparam,
674                  "posix_spawnattr_getschedparam is unportable - "
675                  "use gnulib module posix_spawnattr_getschedparam for portability");
676 # endif
677 #endif
678 
679 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
680 /* Store scheduling parameters in the attribute structure.  */
681 # if @REPLACE_POSIX_SPAWN@
682 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
683 #   define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
684 #  endif
685 _GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
686                   (posix_spawnattr_t *_Restrict_ __attr,
687                    const struct sched_param *_Restrict_ __schedparam)
688                   __THROW _GL_ARG_NONNULL ((1, 2)));
689 _GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
690                   (posix_spawnattr_t *_Restrict_ __attr,
691                    const struct sched_param *_Restrict_ __schedparam));
692 # else
693 #  if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
694 _GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
695                   (posix_spawnattr_t *_Restrict_ __attr,
696                    const struct sched_param *_Restrict_ __schedparam)
697                   __THROW _GL_ARG_NONNULL ((1, 2)));
698 #  endif
699 _GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
700                   (posix_spawnattr_t *_Restrict_ __attr,
701                    const struct sched_param *_Restrict_ __schedparam));
702 # endif
703 _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
704 #elif defined GNULIB_POSIXCHECK
705 # undef posix_spawnattr_setschedparam
706 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
707 _GL_WARN_ON_USE (posix_spawnattr_setschedparam,
708                  "posix_spawnattr_setschedparam is unportable - "
709                  "use gnulib module posix_spawnattr_setschedparam for portability");
710 # endif
711 #endif
712 
713 
714 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
715 /* Initialize data structure for file attribute for 'spawn' call.  */
716 # if @REPLACE_POSIX_SPAWN@
717 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718 #   define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
719 #  endif
720 _GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
721                   (posix_spawn_file_actions_t *__file_actions)
722                   __THROW _GL_ARG_NONNULL ((1)));
723 _GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
724                   (posix_spawn_file_actions_t *__file_actions));
725 # else
726 #  if !@HAVE_POSIX_SPAWN@
727 _GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
728                   (posix_spawn_file_actions_t *__file_actions)
729                   __THROW _GL_ARG_NONNULL ((1)));
730 #  endif
731 _GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
732                   (posix_spawn_file_actions_t *__file_actions));
733 # endif
734 _GL_CXXALIASWARN (posix_spawn_file_actions_init);
735 #elif defined GNULIB_POSIXCHECK
736 # undef posix_spawn_file_actions_init
737 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
738 _GL_WARN_ON_USE (posix_spawn_file_actions_init,
739                  "posix_spawn_file_actions_init is unportable - "
740                  "use gnulib module posix_spawn_file_actions_init for portability");
741 # endif
742 #endif
743 
744 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
745 /* Free resources associated with FILE-ACTIONS.  */
746 # if @REPLACE_POSIX_SPAWN@
747 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 #   define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
749 #  endif
750 _GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
751                   (posix_spawn_file_actions_t *__file_actions)
752                   __THROW _GL_ARG_NONNULL ((1)));
753 _GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
754                   (posix_spawn_file_actions_t *__file_actions));
755 # else
756 #  if !@HAVE_POSIX_SPAWN@
757 _GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
758                   (posix_spawn_file_actions_t *__file_actions)
759                   __THROW _GL_ARG_NONNULL ((1)));
760 #  endif
761 _GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
762                   (posix_spawn_file_actions_t *__file_actions));
763 # endif
764 _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
765 #elif defined GNULIB_POSIXCHECK
766 # undef posix_spawn_file_actions_destroy
767 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
768 _GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
769                  "posix_spawn_file_actions_destroy is unportable - "
770                  "use gnulib module posix_spawn_file_actions_destroy for portability");
771 # endif
772 #endif
773 
774 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
775 /* Add an action to FILE-ACTIONS which tells the implementation to call
776    'open' for the given file during the 'spawn' call.  */
777 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
778 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
779 #   define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
780 #  endif
781 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
782                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
783                    int __fd,
784                    const char *_Restrict_ __path, int __oflag, mode_t __mode)
785                   __THROW _GL_ARG_NONNULL ((1, 3)));
786 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
787                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
788                    int __fd,
789                    const char *_Restrict_ __path, int __oflag, mode_t __mode));
790 # else
791 #  if !@HAVE_POSIX_SPAWN@
792 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
793                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
794                    int __fd,
795                    const char *_Restrict_ __path, int __oflag, mode_t __mode)
796                   __THROW _GL_ARG_NONNULL ((1, 3)));
797 #  endif
798 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
799                   (posix_spawn_file_actions_t *_Restrict_ __file_actions,
800                    int __fd,
801                    const char *_Restrict_ __path, int __oflag, mode_t __mode));
802 # endif
803 _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
804 #elif defined GNULIB_POSIXCHECK
805 # undef posix_spawn_file_actions_addopen
806 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
807 _GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
808                  "posix_spawn_file_actions_addopen is unportable - "
809                  "use gnulib module posix_spawn_file_actions_addopen for portability");
810 # endif
811 #endif
812 
813 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
814 /* Add an action to FILE-ACTIONS which tells the implementation to call
815    'close' for the given file descriptor during the 'spawn' call.  */
816 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
817 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
818 #   define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
819 #  endif
820 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
821                   (posix_spawn_file_actions_t *__file_actions, int __fd)
822                   __THROW _GL_ARG_NONNULL ((1)));
823 _GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
824                   (posix_spawn_file_actions_t *__file_actions, int __fd));
825 # else
826 #  if !@HAVE_POSIX_SPAWN@
827 _GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
828                   (posix_spawn_file_actions_t *__file_actions, int __fd)
829                   __THROW _GL_ARG_NONNULL ((1)));
830 #  endif
831 _GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
832                   (posix_spawn_file_actions_t *__file_actions, int __fd));
833 # endif
834 _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
835 #elif defined GNULIB_POSIXCHECK
836 # undef posix_spawn_file_actions_addclose
837 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
838 _GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
839                  "posix_spawn_file_actions_addclose is unportable - "
840                  "use gnulib module posix_spawn_file_actions_addclose for portability");
841 # endif
842 #endif
843 
844 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
845 /* Add an action to FILE-ACTIONS which tells the implementation to call
846    'dup2' for the given file descriptors during the 'spawn' call.  */
847 # if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
848 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
849 #   define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
850 #  endif
851 _GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
852                   (posix_spawn_file_actions_t *__file_actions,
853                    int __fd, int __newfd)
854                   __THROW _GL_ARG_NONNULL ((1)));
855 _GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
856                   (posix_spawn_file_actions_t *__file_actions,
857                    int __fd, int __newfd));
858 # else
859 #  if !@HAVE_POSIX_SPAWN@
860 _GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
861                   (posix_spawn_file_actions_t *__file_actions,
862                    int __fd, int __newfd)
863                   __THROW _GL_ARG_NONNULL ((1)));
864 #  endif
865 _GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
866                   (posix_spawn_file_actions_t *__file_actions,
867                    int __fd, int __newfd));
868 # endif
869 _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
870 #elif defined GNULIB_POSIXCHECK
871 # undef posix_spawn_file_actions_adddup2
872 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
873 _GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
874                  "posix_spawn_file_actions_adddup2 is unportable - "
875                  "use gnulib module posix_spawn_file_actions_adddup2 for portability");
876 # endif
877 #endif
878 
879 
880 #endif /* _@GUARD_PREFIX@_SPAWN_H */
881 #endif /* _@GUARD_PREFIX@_SPAWN_H */
882