aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-02-14 16:16:16 +0000
committerRon Yorston <rmy@pobox.com>2012-02-14 16:16:16 +0000
commit4d8a277d59ad9c4036c9c595e0647a900f6bd7c8 (patch)
tree8c55fc0d3938edf1ca94e03958169e0aaa858be5
parentf8e39b2d614ea3e853ff0454e60b55f9f5c522c2 (diff)
downloadbusybox-w32-4d8a277d59ad9c4036c9c595e0647a900f6bd7c8.tar.gz
busybox-w32-4d8a277d59ad9c4036c9c595e0647a900f6bd7c8.tar.bz2
busybox-w32-4d8a277d59ad9c4036c9c595e0647a900f6bd7c8.zip
Implement nonblocking wait
-rw-r--r--shell/ash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index de1116656..1061e55c2 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4079,7 +4079,7 @@ static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
4079 * They don't support waitpid(-1) 4079 * They don't support waitpid(-1)
4080 */ 4080 */
4081static pid_t 4081static pid_t
4082waitpid_child(int *status) 4082waitpid_child(int *status, int wait_flags)
4083{ 4083{
4084 HANDLE *pidlist, *pidp; 4084 HANDLE *pidlist, *pidp;
4085 int pid_nr = 0; 4085 int pid_nr = 0;
@@ -4111,7 +4111,8 @@ waitpid_child(int *status)
4111 LOOP(*pidp++ = (HANDLE)ps->ps_pid); 4111 LOOP(*pidp++ = (HANDLE)ps->ps_pid);
4112 #undef LOOP 4112 #undef LOOP
4113 4113
4114 idx = WaitForMultipleObjects(pid_nr, pidlist, FALSE, INFINITE); 4114 idx = WaitForMultipleObjects(pid_nr, pidlist, FALSE,
4115 wait_flags|WNOHANG ? 0 : INFINITE);
4115 if (idx >= pid_nr) { 4116 if (idx >= pid_nr) {
4116 free(pidlist); 4117 free(pidlist);
4117 return -1; 4118 return -1;
@@ -4150,7 +4151,7 @@ dowait(int wait_flags, struct job *job)
4150 if (doing_jobctl) 4151 if (doing_jobctl)
4151 wait_flags |= WUNTRACED; 4152 wait_flags |= WUNTRACED;
4152#if ENABLE_PLATFORM_MINGW32 4153#if ENABLE_PLATFORM_MINGW32
4153 pid = waitpid_child(&status); 4154 pid = waitpid_child(&status, wait_flags);
4154#else 4155#else
4155 pid = waitpid(-1, &status, wait_flags); 4156 pid = waitpid(-1, &status, wait_flags);
4156#endif 4157#endif