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