sl@0
|
1 |
/** @file ../include/sys/wait.h
|
sl@0
|
2 |
@internalComponent
|
sl@0
|
3 |
*/
|
sl@0
|
4 |
|
sl@0
|
5 |
/** @fn wait(int *status)
|
sl@0
|
6 |
@param status
|
sl@0
|
7 |
|
sl@0
|
8 |
Note: This description also covers the following functions -
|
sl@0
|
9 |
waitpid()
|
sl@0
|
10 |
|
sl@0
|
11 |
@return If wait returns due to a stopped
|
sl@0
|
12 |
or terminated child process, the process ID of the child
|
sl@0
|
13 |
is returned to the calling process.
|
sl@0
|
14 |
Otherwise, a value of -1
|
sl@0
|
15 |
is returned and errno is set to indicate the error. If wait4 , wait3 ,
|
sl@0
|
16 |
or waitpid returns due to a stopped
|
sl@0
|
17 |
or terminated child process, the process ID of the child
|
sl@0
|
18 |
is returned to the calling process.
|
sl@0
|
19 |
If there are no children not previously awaited,
|
sl@0
|
20 |
-1 is returned with errno set to ECHILD .
|
sl@0
|
21 |
Otherwise, if WNOHANG is specified and there are
|
sl@0
|
22 |
no stopped or exited children,
|
sl@0
|
23 |
0 is returned.
|
sl@0
|
24 |
If an error is detected or a caught signal aborts the call,
|
sl@0
|
25 |
a value of -1
|
sl@0
|
26 |
is returned and errno is set to indicate the error.
|
sl@0
|
27 |
|
sl@0
|
28 |
The wait function suspends execution of its calling process until status information is available for a terminated child process,
|
sl@0
|
29 |
or a signal is received.
|
sl@0
|
30 |
On return from a successful wait call,
|
sl@0
|
31 |
the status area contains termination information about the process that exited
|
sl@0
|
32 |
as defined below.
|
sl@0
|
33 |
|
sl@0
|
34 |
The wpid argument specifies the set of child processes for which to wait.
|
sl@0
|
35 |
If wpid is -1, the call waits for any child process.
|
sl@0
|
36 |
If wpid is 0,
|
sl@0
|
37 |
the call waits for any child process in the process group of the caller.
|
sl@0
|
38 |
If wpid is greater than zero, the call waits for the process with process id wpid .
|
sl@0
|
39 |
If wpid is less than -1, the call waits for any process whose process group id
|
sl@0
|
40 |
equals the absolute value of wpid .
|
sl@0
|
41 |
|
sl@0
|
42 |
|
sl@0
|
43 |
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
The waitpid function is identical to wait4 with an rusage value of zero.
|
sl@0
|
47 |
|
sl@0
|
48 |
Note:
|
sl@0
|
49 |
|
sl@0
|
50 |
The waitpid function waits for a process ID which is obtained using a
|
sl@0
|
51 |
non-standard API popen3
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
|
sl@0
|
58 |
|
sl@0
|
59 |
@see _exit()
|
sl@0
|
60 |
@see exit()
|
sl@0
|
61 |
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
@publishedAll
|
sl@0
|
66 |
@externallyDefinedApi
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
|
sl@0
|
69 |
/** @fn waitpid(pid_t wpid, int *status, int options)
|
sl@0
|
70 |
@param wpid
|
sl@0
|
71 |
@param status
|
sl@0
|
72 |
@param options
|
sl@0
|
73 |
|
sl@0
|
74 |
Refer to wait() for the documentation
|
sl@0
|
75 |
|
sl@0
|
76 |
@see _exit()
|
sl@0
|
77 |
@see exit()
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
|
sl@0
|
81 |
|
sl@0
|
82 |
@publishedAll
|
sl@0
|
83 |
@externallyDefinedApi
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
|
sl@0
|
86 |
|
sl@0
|
87 |
/** @def _W_INT(w)
|
sl@0
|
88 |
|
sl@0
|
89 |
Macros to test the exit status returned by wait and extract the relevant values. Convert union wait to int.
|
sl@0
|
90 |
|
sl@0
|
91 |
@publishedAll
|
sl@0
|
92 |
@released
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
|
sl@0
|
95 |
/** @def WCOREFLAG
|
sl@0
|
96 |
|
sl@0
|
97 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
98 |
|
sl@0
|
99 |
@publishedAll
|
sl@0
|
100 |
@externallyDefinedApi
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
|
sl@0
|
103 |
/** @def _WSTATUS(x)
|
sl@0
|
104 |
|
sl@0
|
105 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
106 |
|
sl@0
|
107 |
@publishedAll
|
sl@0
|
108 |
@released
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
|
sl@0
|
111 |
/** @def _WSTOPPED
|
sl@0
|
112 |
|
sl@0
|
113 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
114 |
|
sl@0
|
115 |
@publishedAll
|
sl@0
|
116 |
@released
|
sl@0
|
117 |
*/
|
sl@0
|
118 |
|
sl@0
|
119 |
/** @def WIFSTOPPED(x)
|
sl@0
|
120 |
|
sl@0
|
121 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
122 |
|
sl@0
|
123 |
@publishedAll
|
sl@0
|
124 |
@externallyDefinedApi
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
|
sl@0
|
127 |
/** @def WSTOPSIG(x)
|
sl@0
|
128 |
|
sl@0
|
129 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
130 |
|
sl@0
|
131 |
@publishedAll
|
sl@0
|
132 |
@externallyDefinedApi
|
sl@0
|
133 |
*/
|
sl@0
|
134 |
|
sl@0
|
135 |
/** @def WIFSIGNALED(x)
|
sl@0
|
136 |
|
sl@0
|
137 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
138 |
|
sl@0
|
139 |
@publishedAll
|
sl@0
|
140 |
@externallyDefinedApi
|
sl@0
|
141 |
*/
|
sl@0
|
142 |
|
sl@0
|
143 |
/** @def WTERMSIG(x)
|
sl@0
|
144 |
|
sl@0
|
145 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
146 |
|
sl@0
|
147 |
@publishedAll
|
sl@0
|
148 |
@externallyDefinedApi
|
sl@0
|
149 |
*/
|
sl@0
|
150 |
|
sl@0
|
151 |
/** @def WIFEXITED(x)
|
sl@0
|
152 |
|
sl@0
|
153 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
154 |
|
sl@0
|
155 |
@publishedAll
|
sl@0
|
156 |
@externallyDefinedApi
|
sl@0
|
157 |
*/
|
sl@0
|
158 |
|
sl@0
|
159 |
/** @def WEXITSTATUS(x)
|
sl@0
|
160 |
|
sl@0
|
161 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
162 |
|
sl@0
|
163 |
@publishedAll
|
sl@0
|
164 |
@externallyDefinedApi
|
sl@0
|
165 |
*/
|
sl@0
|
166 |
|
sl@0
|
167 |
/** @def WIFCONTINUED(x)
|
sl@0
|
168 |
|
sl@0
|
169 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
170 |
|
sl@0
|
171 |
@publishedAll
|
sl@0
|
172 |
@externallyDefinedApi
|
sl@0
|
173 |
*/
|
sl@0
|
174 |
|
sl@0
|
175 |
/** @def WCOREDUMP(x)
|
sl@0
|
176 |
|
sl@0
|
177 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
178 |
|
sl@0
|
179 |
@publishedAll
|
sl@0
|
180 |
@externallyDefinedApi
|
sl@0
|
181 |
*/
|
sl@0
|
182 |
|
sl@0
|
183 |
|
sl@0
|
184 |
/** @def W_EXITCODE(ret, sig)
|
sl@0
|
185 |
|
sl@0
|
186 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
187 |
|
sl@0
|
188 |
@publishedAll
|
sl@0
|
189 |
@externallyDefinedApi
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
|
sl@0
|
192 |
/** @def W_STOPCODE(sig)
|
sl@0
|
193 |
|
sl@0
|
194 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
195 |
|
sl@0
|
196 |
@publishedAll
|
sl@0
|
197 |
@externallyDefinedApi
|
sl@0
|
198 |
*/
|
sl@0
|
199 |
|
sl@0
|
200 |
/** @def WIFTERMINATED(x)
|
sl@0
|
201 |
|
sl@0
|
202 |
Macros to test the termination code returned by wait and extract the relevant values.
|
sl@0
|
203 |
|
sl@0
|
204 |
@publishedAll
|
sl@0
|
205 |
@externallyDefinedApi
|
sl@0
|
206 |
*/
|
sl@0
|
207 |
|
sl@0
|
208 |
/** @def WTERMINATESTATUS(x)
|
sl@0
|
209 |
|
sl@0
|
210 |
Macros to test the termination code returned by wait and extract the relevant values.
|
sl@0
|
211 |
|
sl@0
|
212 |
@publishedAll
|
sl@0
|
213 |
@externallyDefinedApi
|
sl@0
|
214 |
*/
|
sl@0
|
215 |
|
sl@0
|
216 |
/** @def WIFPANICED(x)
|
sl@0
|
217 |
|
sl@0
|
218 |
Macros to test the panic code returned by wait and extract the relevant values.
|
sl@0
|
219 |
|
sl@0
|
220 |
@publishedAll
|
sl@0
|
221 |
@externallyDefinedApi
|
sl@0
|
222 |
*/
|
sl@0
|
223 |
|
sl@0
|
224 |
/** @def WPANICCODE(x)
|
sl@0
|
225 |
|
sl@0
|
226 |
Macros to test the panic code returned by wait and extract the relevant values.
|
sl@0
|
227 |
|
sl@0
|
228 |
@publishedAll
|
sl@0
|
229 |
@externallyDefinedApi
|
sl@0
|
230 |
*/
|
sl@0
|
231 |
|
sl@0
|
232 |
/** @def WNOHANG
|
sl@0
|
233 |
|
sl@0
|
234 |
Don't hang in wait.
|
sl@0
|
235 |
|
sl@0
|
236 |
@publishedAll
|
sl@0
|
237 |
@externallyDefinedApi
|
sl@0
|
238 |
*/
|
sl@0
|
239 |
|
sl@0
|
240 |
/** @def WUNTRACED
|
sl@0
|
241 |
|
sl@0
|
242 |
Tell about stopped, untraced children.
|
sl@0
|
243 |
|
sl@0
|
244 |
@publishedAll
|
sl@0
|
245 |
@externallyDefinedApi
|
sl@0
|
246 |
*/
|
sl@0
|
247 |
|
sl@0
|
248 |
/** @def WCONTINUED
|
sl@0
|
249 |
|
sl@0
|
250 |
Report a job control continued process.
|
sl@0
|
251 |
|
sl@0
|
252 |
@publishedAll
|
sl@0
|
253 |
@externallyDefinedApi
|
sl@0
|
254 |
*/
|
sl@0
|
255 |
|
sl@0
|
256 |
|
sl@0
|
257 |
/** @def WAIT_ANY
|
sl@0
|
258 |
|
sl@0
|
259 |
Any process. Tokens for special values of the pid parameter to wait4.
|
sl@0
|
260 |
|
sl@0
|
261 |
@publishedAll
|
sl@0
|
262 |
@released
|
sl@0
|
263 |
*/
|
sl@0
|
264 |
|
sl@0
|
265 |
|
sl@0
|
266 |
/** @def WCOREFLAG
|
sl@0
|
267 |
|
sl@0
|
268 |
Macros to test the exit status returned by wait and extract the relevant values.
|
sl@0
|
269 |
|
sl@0
|
270 |
@publishedAll
|
sl@0
|
271 |
@released
|
sl@0
|
272 |
*/
|
sl@0
|
273 |
|
sl@0
|
274 |
|
sl@0
|
275 |
/** @def WLINUXCLONE
|
sl@0
|
276 |
|
sl@0
|
277 |
Wait for kthread spawned from linux_clone.
|
sl@0
|
278 |
|
sl@0
|
279 |
@publishedAll
|
sl@0
|
280 |
@released
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
|
sl@0
|
283 |
|
sl@0
|
284 |
/** @def WAIT_MYPGRP
|
sl@0
|
285 |
|
sl@0
|
286 |
Tokens for special values of the pid parameter to wait4. Any process in my process group.
|
sl@0
|
287 |
|
sl@0
|
288 |
@publishedAll
|
sl@0
|
289 |
@released
|
sl@0
|
290 |
*/
|
sl@0
|
291 |
|