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