From: Erik Faye-Lund Date: Fri, 15 Jan 2010 21:30:24 GMT Subject: [PATCH v2 05/14] mingw: support waitpid with pid > 0 and WNOHANG Message-ID: <1263591033-4992-6-git-send-email-kusmabite@gmail.com> In-Reply-To: <1263591033-4992-1-git-send-email-kusmabite@gmail.com> Signed-off-by: Erik Faye-Lund --- compat/mingw.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/compat/mingw.h b/compat/mingw.h index d934e56..3005472 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -134,8 +134,15 @@ static inline int mingw_unlink(const char *pathname) } #define unlink mingw_unlink +#define WNOHANG 1 static inline int waitpid(pid_t pid, int *status, unsigned options) { + if (pid > 0 && options & WNOHANG) { + if (WAIT_OBJECT_0 != WaitForSingleObject((HANDLE)pid, 0)) + return 0; + options &= ~WNOHANG; + } + if (options == 0) return _cwait(status, pid, 0); errno = EINVAL; -- 1.6.6.211.g26720