diff options
author | root <root> | 2007-11-27 06:19:08 +0000 |
---|---|---|
committer | root <root> | 2007-11-27 06:19:08 +0000 |
commit | b57eb07483ea889f20500834cba164374cdec35b (patch) | |
tree | a546cc1959ea0b7a343bab40d271aaa82cb55f15 /ev.c | |
parent | 92dcada736d22a0f8f2ed4351713c0299db32138 (diff) |
try without wcontinued for borked systems
Diffstat (limited to 'ev.c')
-rw-r--r-- | ev.c | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -717,10 +717,6 @@ static ev_child *childs [PID_HASHSIZE]; static ev_signal childev; -#ifndef WCONTINUED -# define WCONTINUED 0 -#endif - void inline_speed child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status) { @@ -736,20 +732,28 @@ child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status) } } +#ifndef WCONTINUED +# define WCONTINUED 0 +#endif + static void childcb (EV_P_ ev_signal *sw, int revents) { int pid, status; - if (0 < (pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED))) - { - /* make sure we are called again until all childs have been reaped */ - /* we need to do it this way so that the callback gets called before we continue */ - ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); + /* some systems define WCONTINUED but then fail to support it (linux 2.4) */ + if (0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED))) + if (!WCONTINUED + || errno != EINVAL + || 0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED))) + return; - child_reap (EV_A_ sw, pid, pid, status); - child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ - } + /* make sure we are called again until all childs have been reaped */ + /* we need to do it this way so that the callback gets called before we continue */ + ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); + + child_reap (EV_A_ sw, pid, pid, status); + child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ } #endif |