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