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