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