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