mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 12:33:27 +08:00
waitid: implement WNOHANG
If there's no child status available immediately,
return 0 without blocking as specified by the standards.
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:
committed by
Xiang Xiao
parent
6661f56add
commit
91611de0ff
@@ -311,6 +311,22 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((options & WNOHANG) != 0)
|
||||
{
|
||||
/* SUSv4 says:
|
||||
*
|
||||
* "If waitid() returns because WNOHANG was specified and status
|
||||
* is not available for any process specified by idtype and id,
|
||||
* then the si_signo and si_pid members of the structure pointed
|
||||
* to by infop shall be set to zero and the values of other
|
||||
* members of the structure are unspecified."
|
||||
*/
|
||||
|
||||
info->si_signo = 0;
|
||||
info->si_pid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wait for any death-of-child signal */
|
||||
|
||||
ret = nxsig_waitinfo(&set, info);
|
||||
|
||||
Reference in New Issue
Block a user