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 Sun, Nov 06, 2016 at 05:42:48PM +0700, Robert Elz wrote:
>     Date:        Sun, 6 Nov 2016 10:39:22 +0100
>     From:        Nicolas Joly <njoly%pasteur.fr@localhost>
>     Message-ID:  <20161106093922.GA10433%issan.sis.pasteur.fr@localhost>
> 
>   | 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 ...
> 
> 	[ECHILD]
>   	  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()).

Don't we need to report an error because of the "shall" wording in the
ERRORS section.

[...]
The waitid() function shall fail if:

[ECHILD]
    The calling process has no existing unwaited-for child processes.
[...]

http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitid.html

-- 
Nicolas Joly

Cluster & Computing Group
Biology IT Center
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index