chiark / gitweb /
Merge branches 'idx/verh' and 'idx/qmqpc'
[qmail] / wait.3
1 .TH wait 3
2 .SH NAME
3 wait \- check child process status
4 .SH SYNTAX
5 .B #include <wait.h>
6
7 int \fBwait_nohang\fP(&\fIwstat\fR);
8 .br
9 int \fBwait_stop\fP(&\fIwstat\fR);
10 .br
11 int \fBwait_stopnohang\fP(&\fIwstat\fR);
12 .br
13 int \fBwait_pid\fP(&\fIwstat\fR,\fIpid\fR);
14
15 int \fBwait_exitcode\fP(\fIwstat\fR);
16 .br
17 int \fBwait_crashed\fP(\fIwstat\fR);
18 .br
19 int \fBwait_stopped\fP(\fIwstat\fR);
20 .br
21 int \fBwait_stopsig\fP(\fIwstat\fR);
22
23 int \fIpid\fR;
24 .br
25 int \fIwstat\fR;
26 .SH DESCRIPTION
27 .B wait_nohang
28 looks for zombies (child processes that have exited).
29 If it sees a zombie,
30 it eliminates the zombie,
31 puts the zombie's exit status into
32 .IR wstat ,
33 and returns the zombie's process ID.
34 If there are several zombies,
35 .B wait_nohang
36 picks one.
37 If there are children but no zombies,
38 .B wait_nohang
39 returns 0.
40 If there are no children,
41 .B wait_nohang
42 returns -1,
43 setting
44 .B errno
45 appropriately.
46
47 .B wait_stopnohang
48 is similar to
49 .BR wait_nohang ,
50 but it also looks for children that have stopped.
51
52 .B wait_stop
53 is similar to
54 .BR wait_stopnohang ,
55 but if there are children it will pause waiting for one of them
56 to stop or exit.
57
58 .B wait_pid
59 waits for child process
60 .I pid
61 to exit.
62 It eliminates any zombie that shows up in the meantime,
63 discarding the exit status.
64
65 .B wait_stop
66 and
67 .B wait_pid
68 retry upon
69 .BR error_intr .
70 .SH "STATUS PARSING"
71 If the child stopped,
72 .B wait_stopped
73 is nonzero;
74 .B wait_stopsig
75 is the signal that caused the child to stop.
76
77 If the child exited by crashing,
78 .B wait_stopped
79 is zero;
80 .B wait_crashed
81 is nonzero.
82
83 If the child exited normally,
84 .B wait_stopped
85 is zero;
86 .B wait_crashed
87 is zero;
88 and
89 .B wait_exitcode
90 is the child's exit code.
91 .SH "SEE ALSO"
92 wait(2),
93 error(3)