spawn: Fix incomplete fix.
[gnulib.git] / lib / spawn.in.h
1 /* Definitions for POSIX spawn interface.
2    Copyright (C) 2000, 2003, 2004, 2008-2009 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 definition of GL_LINK_WARNING is copied here.  */
74
75 /* The definition of _GL_ARG_NONNULL is copied here.  */
76
77
78 /* Data structure to contain attributes for thread creation.  */
79 #if @REPLACE_POSIX_SPAWN@
80 # define posix_spawnattr_t rpl_posix_spawnattr_t
81 #endif
82 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
83 typedef struct
84 {
85   short int _flags;
86   pid_t _pgrp;
87   sigset_t _sd;
88   sigset_t _ss;
89   struct sched_param _sp;
90   int _policy;
91   int __pad[16];
92 } posix_spawnattr_t;
93 #endif
94
95
96 /* Data structure to contain information about the actions to be
97    performed in the new process with respect to file descriptors.  */
98 #if @REPLACE_POSIX_SPAWN@
99 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
100 #endif
101 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
102 typedef struct
103 {
104   int _allocated;
105   int _used;
106   struct __spawn_action *_actions;
107   int __pad[16];
108 } posix_spawn_file_actions_t;
109 #endif
110
111
112 /* Flags to be set in the `posix_spawnattr_t'.  */
113 #if @REPLACE_POSIX_SPAWN@
114 /* Use the values from the system, for better compatibility.  */
115 /* But this implementation does not support AIX extensions.  */
116 # undef POSIX_SPAWN_FORK_HANDLERS
117 #else
118 # define POSIX_SPAWN_RESETIDS           0x01
119 # define POSIX_SPAWN_SETPGROUP          0x02
120 # define POSIX_SPAWN_SETSIGDEF          0x04
121 # define POSIX_SPAWN_SETSIGMASK         0x08
122 # define POSIX_SPAWN_SETSCHEDPARAM      0x10
123 # define POSIX_SPAWN_SETSCHEDULER       0x20
124 #endif
125 /* A GNU extension.  Use the next free bit position.  */
126 #define POSIX_SPAWN_USEVFORK \
127   ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1)                   \
128     | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1)               \
129     | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1)               \
130     | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1)             \
131     | POSIX_SPAWN_SETSCHEDPARAM | (POSIX_SPAWN_SETSCHEDPARAM - 1)       \
132     | POSIX_SPAWN_SETSCHEDULER | (POSIX_SPAWN_SETSCHEDULER - 1))        \
133    + 1)
134 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
135             [2 * (((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
136                     | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
137                     | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
138                    & POSIX_SPAWN_USEVFORK) == 0) - 1];
139
140
141 #ifdef __cplusplus
142 extern "C" {
143 #endif
144
145
146 #if @GNULIB_POSIX_SPAWN@
147 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
148    Before running the process perform the actions described in FILE-ACTIONS.
149
150    This function is a possible cancellation points and therefore not
151    marked with __THROW. */
152 # if @REPLACE_POSIX_SPAWN@
153 #  define posix_spawn rpl_posix_spawn
154 # endif
155 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
156 extern int posix_spawn (pid_t *_Restrict_ __pid,
157                         const char *_Restrict_ __path,
158                         const posix_spawn_file_actions_t *_Restrict_ __file_actions,
159                         const posix_spawnattr_t *_Restrict_ __attrp,
160                         char *const argv[_Restrict_arr_],
161                         char *const envp[_Restrict_arr_])
162      _GL_ARG_NONNULL ((2, 5, 6));
163 # endif
164 #elif defined GNULIB_POSIXCHECK
165 # undef posix_spawn
166 # define posix_spawn(a,b,c,d,e,f)                   \
167   (GL_LINK_WARNING ("posix_spawn is unportable - "        \
168                     "use gnulib module posix_spawn for portability"),   \
169    posix_spawn (a, b, c, d, e, f))
170 #endif
171
172 #if @GNULIB_POSIX_SPAWNP@
173 /* Similar to `posix_spawn' but search for FILE in the PATH.
174
175    This function is a possible cancellation points and therefore not
176    marked with __THROW.  */
177 # if @REPLACE_POSIX_SPAWN@
178 #  define posix_spawnp rpl_posix_spawnp
179 # endif
180 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
181 extern int posix_spawnp (pid_t *__pid, const char *__file,
182                          const posix_spawn_file_actions_t *__file_actions,
183                          const posix_spawnattr_t *__attrp,
184                          char *const argv[], char *const envp[])
185      _GL_ARG_NONNULL ((2, 5, 6));
186 # endif
187 #elif defined GNULIB_POSIXCHECK
188 # undef posix_spawnp
189 # define posix_spawnp(a,b,c,d,e,f)                   \
190   (GL_LINK_WARNING ("posix_spawnp is unportable - "        \
191                     "use gnulib module posix_spawnp for portability"),   \
192    posix_spawnp (a, b, c, d, e, f))
193 #endif
194
195
196 #if @GNULIB_POSIX_SPAWNATTR_INIT@
197 /* Initialize data structure with attributes for `spawn' to default values.  */
198 # if @REPLACE_POSIX_SPAWN@
199 #  define posix_spawnattr_init rpl_posix_spawnattr_init
200 # endif
201 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
202 extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
203      __THROW _GL_ARG_NONNULL ((1));
204 # endif
205 #elif defined GNULIB_POSIXCHECK
206 # undef posix_spawnattr_init
207 # define posix_spawnattr_init(a)                   \
208   (GL_LINK_WARNING ("posix_spawnattr_init is unportable - "        \
209                     "use gnulib module posix_spawnattr_init for portability"), \
210    posix_spawnattr_init (a))
211 #endif
212
213 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
214 /* Free resources associated with ATTR.  */
215 # if @REPLACE_POSIX_SPAWN@
216 #  define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
217 # endif
218 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
219 extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
220      __THROW _GL_ARG_NONNULL ((1));
221 # endif
222 #elif defined GNULIB_POSIXCHECK
223 # undef posix_spawnattr_destroy
224 # define posix_spawnattr_destroy(a)                   \
225   (GL_LINK_WARNING ("posix_spawnattr_destroy is unportable - "        \
226                     "use gnulib module posix_spawnattr_destroy for portability"), \
227    posix_spawnattr_destroy (a))
228 #endif
229
230 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
231 /* Store signal mask for signals with default handling from ATTR in
232    SIGDEFAULT.  */
233 # if @REPLACE_POSIX_SPAWN@
234 #  define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
235 # endif
236 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
237 extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *_Restrict_ __attr,
238                                           sigset_t *_Restrict_ __sigdefault)
239      __THROW _GL_ARG_NONNULL ((1, 2));
240 # endif
241 #elif defined GNULIB_POSIXCHECK
242 # undef posix_spawnattr_getsigdefault
243 # define posix_spawnattr_getsigdefault(a, b)                         \
244   (GL_LINK_WARNING ("posix_spawnattr_getsigdefault is unportable - "        \
245                     "use gnulib module posix_spawnattr_getsigdefault for portability"), \
246    posix_spawnattr_getsigdefault (a, b))
247 #endif
248
249 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
250 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT.  */
251 # if @REPLACE_POSIX_SPAWN@
252 #  define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
253 # endif
254 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
255 extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *_Restrict_ __attr,
256                                           const sigset_t *_Restrict_ __sigdefault)
257      __THROW _GL_ARG_NONNULL ((1, 2));
258 # endif
259 #elif defined GNULIB_POSIXCHECK
260 # undef posix_spawnattr_setsigdefault
261 # define posix_spawnattr_setsigdefault(a, b)                         \
262   (GL_LINK_WARNING ("posix_spawnattr_setsigdefault is unportable - "        \
263                     "use gnulib module posix_spawnattr_setsigdefault for portability"), \
264    posix_spawnattr_setsigdefault (a, b))
265 #endif
266
267 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
268 /* Store signal mask for the new process from ATTR in SIGMASK.  */
269 # if @REPLACE_POSIX_SPAWN@
270 #  define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
271 # endif
272 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
273 extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *_Restrict_ __attr,
274                                        sigset_t *_Restrict_ __sigmask)
275      __THROW _GL_ARG_NONNULL ((1, 2));
276 # endif
277 #elif defined GNULIB_POSIXCHECK
278 # undef posix_spawnattr_getsigmask
279 # define posix_spawnattr_getsigmask(a, b)                         \
280   (GL_LINK_WARNING ("posix_spawnattr_getsigmask is unportable - "        \
281                     "use gnulib module posix_spawnattr_getsigmask for portability"), \
282    posix_spawnattr_getsigmask (a, b))
283 #endif
284
285 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
286 /* Set signal mask for the new process in ATTR to SIGMASK.  */
287 # if @REPLACE_POSIX_SPAWN@
288 #  define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
289 # endif
290 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
291 extern int posix_spawnattr_setsigmask (posix_spawnattr_t *_Restrict_ __attr,
292                                        const sigset_t *_Restrict_ __sigmask)
293      __THROW _GL_ARG_NONNULL ((1, 2));
294 # endif
295 #elif defined GNULIB_POSIXCHECK
296 # undef posix_spawnattr_setsigmask
297 # define posix_spawnattr_setsigmask(a, b)                         \
298   (GL_LINK_WARNING ("posix_spawnattr_setsigmask is unportable - "        \
299                     "use gnulib module posix_spawnattr_setsigmask for portability"), \
300    posix_spawnattr_setsigmask (a, b))
301 #endif
302
303 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
304 /* Get flag word from the attribute structure.  */
305 # if @REPLACE_POSIX_SPAWN@
306 #  define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
307 # endif
308 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
309 extern int posix_spawnattr_getflags (const posix_spawnattr_t *_Restrict_ __attr,
310                                      short int *_Restrict_ __flags)
311      __THROW _GL_ARG_NONNULL ((1, 2));
312 # endif
313 #elif defined GNULIB_POSIXCHECK
314 # undef posix_spawnattr_getflags
315 # define posix_spawnattr_getflags(a, b)                         \
316   (GL_LINK_WARNING ("posix_spawnattr_getflags is unportable - "        \
317                     "use gnulib module posix_spawnattr_getflags for portability"), \
318    posix_spawnattr_getflags (a, b))
319 #endif
320
321 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
322 /* Store flags in the attribute structure.  */
323 # if @REPLACE_POSIX_SPAWN@
324 #  define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
325 # endif
326 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
327 extern int posix_spawnattr_setflags (posix_spawnattr_t *__attr,
328                                      short int __flags)
329      __THROW _GL_ARG_NONNULL ((1));
330 # endif
331 #elif defined GNULIB_POSIXCHECK
332 # undef posix_spawnattr_setflags
333 # define posix_spawnattr_setflags(a, b)                         \
334   (GL_LINK_WARNING ("posix_spawnattr_setflags is unportable - "        \
335                     "use gnulib module posix_spawnattr_setflags for portability"), \
336    posix_spawnattr_setflags (a, b))
337 #endif
338
339 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
340 /* Get process group ID from the attribute structure.  */
341 # if @REPLACE_POSIX_SPAWN@
342 #  define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
343 # endif
344 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
345 extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *_Restrict_ __attr,
346                                       pid_t *_Restrict_ __pgroup)
347      __THROW _GL_ARG_NONNULL ((1, 2));
348 # endif
349 #elif defined GNULIB_POSIXCHECK
350 # undef posix_spawnattr_getpgroup
351 # define posix_spawnattr_getpgroup(a, b)                         \
352   (GL_LINK_WARNING ("posix_spawnattr_getpgroup is unportable - "        \
353                     "use gnulib module posix_spawnattr_getpgroup for portability"), \
354    posix_spawnattr_getpgroup (a, b))
355 #endif
356
357 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
358 /* Store process group ID in the attribute structure.  */
359 # if @REPLACE_POSIX_SPAWN@
360 #  define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
361 # endif
362 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
363 extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
364                                       pid_t __pgroup)
365      __THROW _GL_ARG_NONNULL ((1));
366 # endif
367 #elif defined GNULIB_POSIXCHECK
368 # undef posix_spawnattr_setpgroup
369 # define posix_spawnattr_setpgroup(a, b)                         \
370   (GL_LINK_WARNING ("posix_spawnattr_setpgroup is unportable - "        \
371                     "use gnulib module posix_spawnattr_setpgroup for portability"), \
372    posix_spawnattr_setpgroup (a, b))
373 #endif
374
375 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
376 /* Get scheduling policy from the attribute structure.  */
377 # if @REPLACE_POSIX_SPAWN@
378 #  define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
379 # endif
380 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
381 extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *_Restrict_ __attr,
382                                            int *_Restrict_ __schedpolicy)
383      __THROW _GL_ARG_NONNULL ((1, 2));
384 # endif
385 #elif defined GNULIB_POSIXCHECK
386 # undef posix_spawnattr_getschedpolicy
387 # define posix_spawnattr_getschedpolicy(a, b)                         \
388   (GL_LINK_WARNING ("posix_spawnattr_getschedpolicy is unportable - "        \
389                     "use gnulib module posix_spawnattr_getschedpolicy for portability"), \
390    posix_spawnattr_getschedpolicy (a, b))
391 #endif
392
393 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
394 /* Store scheduling policy in the attribute structure.  */
395 # if @REPLACE_POSIX_SPAWN@
396 #  define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
397 # endif
398 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
399 extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
400                                            int __schedpolicy)
401      __THROW _GL_ARG_NONNULL ((1));
402 # endif
403 #elif defined GNULIB_POSIXCHECK
404 # undef posix_spawnattr_setschedpolicy
405 # define posix_spawnattr_setschedpolicy(a, b)                         \
406   (GL_LINK_WARNING ("posix_spawnattr_setschedpolicy is unportable - "        \
407                     "use gnulib module posix_spawnattr_setschedpolicy for portability"), \
408    posix_spawnattr_setschedpolicy (a, b))
409 #endif
410
411 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
412 /* Get scheduling parameters from the attribute structure.  */
413 # if @REPLACE_POSIX_SPAWN@
414 #  define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
415 # endif
416 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
417 extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *_Restrict_ __attr,
418                                           struct sched_param *_Restrict_ __schedparam)
419      __THROW _GL_ARG_NONNULL ((1, 2));
420 # endif
421 #elif defined GNULIB_POSIXCHECK
422 # undef posix_spawnattr_getschedparam
423 # define posix_spawnattr_getschedparam(a, b)                         \
424   (GL_LINK_WARNING ("posix_spawnattr_getschedparam is unportable - "        \
425                     "use gnulib module posix_spawnattr_getschedparam for portability"), \
426    posix_spawnattr_getschedparam (a, b))
427 #endif
428
429 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
430 /* Store scheduling parameters in the attribute structure.  */
431 # if @REPLACE_POSIX_SPAWN@
432 #  define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
433 # endif
434 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
435 extern int posix_spawnattr_setschedparam (posix_spawnattr_t *_Restrict_ __attr,
436                                           const struct sched_param *_Restrict_ __schedparam)
437      __THROW _GL_ARG_NONNULL ((1, 2));
438 # endif
439 #elif defined GNULIB_POSIXCHECK
440 # undef posix_spawnattr_setschedparam
441 # define posix_spawnattr_setschedparam(a, b)                         \
442   (GL_LINK_WARNING ("posix_spawnattr_setschedparam is unportable - "        \
443                     "use gnulib module posix_spawnattr_setschedparam for portability"), \
444    posix_spawnattr_setschedparam (a, b))
445 #endif
446
447
448 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
449 /* Initialize data structure for file attribute for `spawn' call.  */
450 # if @REPLACE_POSIX_SPAWN@
451 #  define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
452 # endif
453 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
454 extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_actions)
455      __THROW _GL_ARG_NONNULL ((1));
456 # endif
457 #elif defined GNULIB_POSIXCHECK
458 # undef posix_spawn_file_actions_init
459 # define posix_spawn_file_actions_init(a)                         \
460   (GL_LINK_WARNING ("posix_spawn_file_actions_init is unportable - "        \
461                     "use gnulib module posix_spawn_file_actions_init for portability"), \
462    posix_spawn_file_actions_init (a))
463 #endif
464
465 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
466 /* Free resources associated with FILE-ACTIONS.  */
467 # if @REPLACE_POSIX_SPAWN@
468 #  define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
469 # endif
470 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
471 extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_actions)
472      __THROW _GL_ARG_NONNULL ((1));
473 # endif
474 #elif defined GNULIB_POSIXCHECK
475 # undef posix_spawn_file_actions_destroy
476 # define posix_spawn_file_actions_destroy(a)                         \
477   (GL_LINK_WARNING ("posix_spawn_file_actions_destroy is unportable - "        \
478                     "use gnulib module posix_spawn_file_actions_destroy for portability"), \
479    posix_spawn_file_actions_destroy (a))
480 #endif
481
482 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
483 /* Add an action to FILE-ACTIONS which tells the implementation to call
484    `open' for the given file during the `spawn' call.  */
485 # if @REPLACE_POSIX_SPAWN@
486 #  define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
487 # endif
488 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
489 extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *_Restrict_ __file_actions,
490                                              int __fd,
491                                              const char *_Restrict_ __path,
492                                              int __oflag, mode_t __mode)
493      __THROW _GL_ARG_NONNULL ((1, 3));
494 # endif
495 #elif defined GNULIB_POSIXCHECK
496 # undef posix_spawn_file_actions_addopen
497 # define posix_spawn_file_actions_addopen(a, b, c, d, e)                     \
498   (GL_LINK_WARNING ("posix_spawn_file_actions_addopen is unportable - "        \
499                     "use gnulib module posix_spawn_file_actions_addopen for portability"), \
500    posix_spawn_file_actions_addopen (a, b, c, d, e))
501 #endif
502
503 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
504 /* Add an action to FILE-ACTIONS which tells the implementation to call
505    `close' for the given file descriptor during the `spawn' call.  */
506 # if @REPLACE_POSIX_SPAWN@
507 #  define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
508 # endif
509 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
510 extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *__file_actions,
511                                               int __fd)
512      __THROW _GL_ARG_NONNULL ((1));
513 # endif
514 #elif defined GNULIB_POSIXCHECK
515 # undef posix_spawn_file_actions_addclose
516 # define posix_spawn_file_actions_addclose(a,b)                          \
517   (GL_LINK_WARNING ("posix_spawn_file_actions_addclose is unportable - "        \
518                     "use gnulib module posix_spawn_file_actions_addclose for portability"), \
519    posix_spawn_file_actions_addclose (a, b))
520 #endif
521
522 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
523 /* Add an action to FILE-ACTIONS which tells the implementation to call
524    `dup2' for the given file descriptors during the `spawn' call.  */
525 # if @REPLACE_POSIX_SPAWN@
526 #  define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
527 # endif
528 # if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
529 extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *__file_actions,
530                                              int __fd, int __newfd)
531      __THROW _GL_ARG_NONNULL ((1));
532 # endif
533 #elif defined GNULIB_POSIXCHECK
534 # undef posix_spawn_file_actions_adddup2
535 # define posix_spawn_file_actions_adddup2(a,b,c)                         \
536   (GL_LINK_WARNING ("posix_spawn_file_actions_adddup2 is unportable - "        \
537                     "use gnulib module posix_spawn_file_actions_adddup2 for portability"), \
538    posix_spawn_file_actions_adddup2 (a, b, c))
539 #endif
540
541
542 #ifdef __cplusplus
543 }
544 #endif
545
546
547 #endif /* _GL_SPAWN_H */
548 #endif /* _GL_SPAWN_H */