From: Alan Cox Date: Sat, 6 Jun 2015 00:54:48 +0000 (+0100) Subject: waitpid: correct return for WNOHANG and note another spec compliance bug X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=989a6b5582ac1eaa7743a757b2cb386d873af014;p=FUZIX.git waitpid: correct return for WNOHANG and note another spec compliance bug --- diff --git a/Kernel/syscall_proc.c b/Kernel/syscall_proc.c index 1c6131c0..19e92b35 100644 --- a/Kernel/syscall_proc.c +++ b/Kernel/syscall_proc.c @@ -281,6 +281,8 @@ arg_t _waitpid(void) return (-1); } + /* FIXME: move this scan into the main loop and also error + on a complete loop finding no matchi for pid */ /* See if we have any children. */ for (p = ptab; p < ptab_end; ++p) { if (p->p_status && p->p_pptr == udata.u_ptab @@ -297,7 +299,7 @@ arg_t _waitpid(void) chksigs(); if (udata.u_cursig) { udata.u_error = EINTR; - return (-1); + return -1; } for (p = ptab; p < ptab_end; ++p) { if (p->p_status == P_ZOMBIE @@ -324,7 +326,8 @@ arg_t _waitpid(void) break; psleep(udata.u_ptab); } - return 0; + udata.u_error = EINTR; + return -1; } #undef pid