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