Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wait4(2) do not fail with WNOHANG if there is no child

On 06.11.2016 11:42, Robert Elz wrote:
>     Date:        Sun, 6 Nov 2016 10:39:22 +0100
>     From:        Nicolas Joly <>
>     Message-ID:  <>
>   | Just tested it on 7.0.2 NetBSD/amd64 under qemu, and it works as
>   | expected. Looks like a -current regression.
> In -current, the primary wait*() interface is wait6() - which is
> posix waitid() (also available) plus the extra args needed to allow
> it to also implement wait() wait3() waitpid() and wait4().
> Posix is less clear on whether waitid() is supposed to return 0 or
> ECHILD when WNOHANG is set, and there are no (applicable) children
> (none that match the pid/flags specified - which includes no children
> at all of course.)
> 	If WNOHANG was specified and status is not available for any
> 	process specified by idtype and id, 0 shall be returned.
> but also ...
>   	  The calling process has no existing unwaited-for child processes.
> but generally, the error values only apply when the sys call is stated
> to return an error, which waitid() does not specify when WNOHANG is
> set (unlike it does for waitpid()).
> We haven't yet switched to implementing wait4() (and the other older calls
> all of which use the wait4() interface) via wait6(), so the question now
> is, does this get changed just for the wait4() interface, or for wait6()
> (and hence waitid()) as well.
> kre

I will extend our ATF tests to validate it.

In general the new behavior seems to be working as intended and is
reproducible on other major OSes.

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index