1 /* Definitions for POSIX spawn interface.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
26 #include <sys/types.h>
29 /* Data structure to contain attributes for thread creation. */
36 struct sched_param __sp
;
42 /* Data structure to contain information about the actions to be
43 performed in the new process with respect to file descriptors. */
48 struct __spawn_action
*__actions
;
50 } posix_spawn_file_actions_t
;
53 /* Flags to be set in the `posix_spawnattr_t'. */
54 #define POSIX_SPAWN_RESETIDS 0x01
55 #define POSIX_SPAWN_SETPGROUP 0x02
56 #define POSIX_SPAWN_SETSIGDEF 0x04
57 #define POSIX_SPAWN_SETSIGMASK 0x08
58 #define POSIX_SPAWN_SETSCHEDPARAM 0x10
59 #define POSIX_SPAWN_SETSCHEDULER 0x20
64 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
65 Before running the process perform the actions described in FILE-ACTIONS. */
66 extern int posix_spawn (pid_t
*__pid
, __const
char *__path
,
67 __const posix_spawn_file_actions_t
*__file_actions
,
68 __const posix_spawnattr_t
*__attrp
,
69 char *__const argv
[], char *__const envp
[]) __THROW
;
71 /* Similar to `posix_spawn' but search for FILE in the PATH. */
72 extern int posix_spawnp (pid_t
*__pid
, __const
char *__file
,
73 __const posix_spawn_file_actions_t
*__file_actions
,
74 __const posix_spawnattr_t
*__attrp
,
75 char *__const argv
[], char *__const envp
[]) __THROW
;
78 /* Initialize data structure with attributes for `spawn' to default values. */
79 extern int posix_spawnattr_init (posix_spawnattr_t
*__attr
) __THROW
;
81 /* Free resources associated with ATTR. */
82 extern int posix_spawnattr_destroy (posix_spawnattr_t
*__attr
) __THROW
;
84 /* Store signal mask for signals with default handling from ATTR in
86 extern int posix_spawnattr_getsigdefault (__const posix_spawnattr_t
*__attr
,
87 sigset_t
*__sigdefault
) __THROW
;
89 /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
90 extern int posix_spawnattr_setsigdefault (posix_spawnattr_t
*__attr
,
91 __const sigset_t
*__sigdefault
)
94 /* Store signal mask for the new process from ATTR in SIGMASK. */
95 extern int posix_spawnattr_getsigmask (__const posix_spawnattr_t
*__attr
,
96 sigset_t
*__sigmask
) __THROW
;
98 /* Set signal mask for the new process in ATTR to SIGMASK. */
99 extern int posix_spawnattr_setsigmask (posix_spawnattr_t
*__attr
,
100 __const sigset_t
*__sigmask
) __THROW
;
102 /* Get flag word from the attribute structure. */
103 extern int posix_spawnattr_getflags (__const posix_spawnattr_t
*__attr
,
104 short int *__flags
) __THROW
;
106 /* Store flags in the attribute structure. */
107 extern int posix_spawnattr_setflags (posix_spawnattr_t
*_attr
,
108 short int __flags
) __THROW
;
110 /* Get process group ID from the attribute structure. */
111 extern int posix_spawnattr_getpgroup (__const posix_spawnattr_t
*__attr
,
112 pid_t
*__pgroup
) __THROW
;
114 /* Store process group ID in the attribute structure. */
115 extern int posix_spawnattr_setpgroup (posix_spawnattr_t
*__attr
,
116 pid_t __pgroup
) __THROW
;
118 /* Get scheduling policy from the attribute structure. */
119 extern int posix_spawnattr_getschedpolicy (__const posix_spawnattr_t
*__attr
,
120 int *__schedpolicy
) __THROW
;
122 /* Store scheduling policy in the attribute structure. */
123 extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t
*__attr
,
124 int __schedpolicy
) __THROW
;
127 /* Initialize data structure for file attribute for `spawn' call. */
128 extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t
*
129 __file_actions
) __THROW
;
131 /* Free resources associated with FILE-ACTIONS. */
132 extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t
*
133 __file_actions
) __THROW
;
135 /* Add an action to FILE-ACTIONS which tells the implementation to call
136 `open' for the given file during the `spawn' call. */
137 extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t
*
139 int __fd
, __const
char *__path
,
140 int __oflag
, mode_t __mode
)
143 /* Add an action to FILE-ACTIONS which tells the implementation to call
144 `close' for the given file descriptor during the `spawn' call. */
145 extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t
*
146 __file_actions
, int __fd
)
149 /* Add an action to FILE-ACTIONS which tells the implementation to call
150 `dup2' for the given file descriptors during the `spawn' call. */
151 extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t
*
153 int __fd
, int __newfd
) __THROW
;