Commit | Line | Data |
---|---|---|
e6817382 BJ |
1 | .TH WAIT 2 |
2 | .SH NAME | |
3 | wait \- wait for process to terminate | |
4 | .SH SYNOPSIS | |
5 | .B wait(status) | |
6 | .br | |
7 | .B int *status; | |
8 | .PP | |
9 | .B wait(0) | |
10 | .SH DESCRIPTION | |
11 | .I Wait | |
12 | causes its caller to delay until a signal is received or | |
13 | one of its child | |
14 | processes terminates. | |
15 | If any child has died since the last | |
16 | .I wait, | |
17 | return is immediate; | |
18 | if there are no children, return is immediate with | |
19 | the error bit set | |
20 | (resp. with a value of \-1 returned). | |
21 | The normal return yields the process ID of the terminated child. | |
22 | In the case of several children several | |
23 | .I wait | |
24 | calls are needed | |
25 | to learn of all the deaths. | |
26 | .PP | |
27 | If | |
28 | .RI (int) status | |
29 | is nonzero, the high byte of the word pointed to | |
30 | receives the low byte of the | |
31 | argument of | |
32 | .I exit | |
33 | when the child terminated. | |
34 | The low byte | |
35 | receives the termination status | |
36 | of the process. | |
37 | See | |
38 | .IR signal (2) | |
39 | for a list of termination statuses (signals); | |
40 | 0 status indicates normal termination. | |
41 | A special status (0177) is returned for a stopped process | |
42 | which has not terminated and can be restarted. | |
43 | See | |
44 | .IR ptrace (2). | |
45 | If the 0200 bit of the termination status | |
46 | is set, | |
47 | a core image of the process was produced | |
48 | by the system. | |
49 | .PP | |
50 | If the parent process terminates without | |
51 | waiting on its children, | |
52 | the initialization process | |
53 | (process ID = 1) | |
54 | inherits the children. | |
55 | .SH "SEE ALSO" | |
56 | exit(2), fork(2), signal(2) | |
57 | .SH DIAGNOSTICS | |
58 | Returns | |
59 | \-1 if there are no children not previously waited for. | |
60 | .SH "ASSEMBLER (PDP-11)" | |
61 | (wait = 7.) | |
62 | .br | |
63 | .B sys wait | |
64 | .br | |
65 | (process ID in r0) | |
66 | .br | |
67 | (status in r1) | |
68 | .PP | |
69 | The high byte of the status is | |
70 | the low byte of r0 in the child at termination. |