mirror of https://github.com/mkerrisk/man-pages
wait.2: POSIX.1-2008 TC1 clarifies treatment of 'si_pid' for waitid() WNOHANG
Reported-by: Ильдар Низамов <niya3@mail.ru> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
bc4590d93d
commit
59e30f70a8
31
man2/wait.2
31
man2/wait.2
|
@ -350,16 +350,35 @@ the state of the
|
||||||
.I siginfo_t
|
.I siginfo_t
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.I infop
|
.I infop
|
||||||
is unspecified.
|
depends on the implementation.
|
||||||
.\" POSIX.1-2001 leaves this possibility unspecified; most
|
To (portably) distinguish this case from that where a child was in a
|
||||||
.\" implementations (including Linux) zero out the structure
|
|
||||||
.\" in this case, but at least one implementation (AIX 5.1)
|
|
||||||
.\" does not -- MTK Nov 04
|
|
||||||
To distinguish this case from that where a child was in a
|
|
||||||
waitable state, zero out the
|
waitable state, zero out the
|
||||||
.I si_pid
|
.I si_pid
|
||||||
field before the call and check for a nonzero value in this field
|
field before the call and check for a nonzero value in this field
|
||||||
after the call returns.
|
after the call returns.
|
||||||
|
.PP
|
||||||
|
POSIX.1-2008 Technical Corrigendum 1 (2013) adds the requirement that when
|
||||||
|
.B WNOHANG
|
||||||
|
is specified in
|
||||||
|
.I options
|
||||||
|
and there were no children in a waitable state, then
|
||||||
|
.BR waitid ()
|
||||||
|
should zero out the
|
||||||
|
.I si_pid
|
||||||
|
and
|
||||||
|
.I si_signo
|
||||||
|
fields of the structure.
|
||||||
|
On Linux and other implementations that adhere to this requirement,
|
||||||
|
it is not necessary to zero out the
|
||||||
|
.I si_pid
|
||||||
|
field before calling
|
||||||
|
.BR waitid ().
|
||||||
|
However,
|
||||||
|
not all implementations follow the POSIX.1 specification on this point.
|
||||||
|
.\" POSIX.1-2001 leaves this possibility unspecified; most
|
||||||
|
.\" implementations (including Linux) zero out the structure
|
||||||
|
.\" in this case, but at least one implementation (AIX 5.1)
|
||||||
|
.\" does not -- MTK Nov 04
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
.BR wait ():
|
.BR wait ():
|
||||||
on success, returns the process ID of the terminated child;
|
on success, returns the process ID of the terminated child;
|
||||||
|
|
Loading…
Reference in New Issue