waitpid: implement WNOHANG for CONFIG_SCHED_HAVE_PARENT=y

If there's no child status available immediately,
return 0 without blocking as specified by the standards.

The implementation for non CONFIG_SCHED_HAVE_PARENT case
seems ok in this regard.

I checked the following version of the standard.
I believe it has always been this way though.

    The Open Group Base Specifications Issue 7, 2018 edition
    IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)
This commit is contained in:
YAMAMOTO Takashi 2020-06-26 12:28:52 +09:00 committed by Xiang Xiao
parent 05671fd8f1
commit 6661f56add
1 changed files with 6 additions and 0 deletions

View File

@ -390,6 +390,12 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
#endif /* CONFIG_SCHED_CHILD_STATUS */
if ((options & WNOHANG) != 0)
{
pid = 0;
break;
}
/* Wait for any death-of-child signal */
ret = nxsig_waitinfo(&set, &info);