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)
{
}
}
+#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
# define lstat(a,b) stat(a,b)
# endif
+#define DEF_STAT_INTERVAL 5.0074891
+#define MIN_STAT_INTERVAL 0.1074891
+
void
ev_stat_stat (EV_P_ ev_stat *w)
{
ev_stat_stat (EV_A_ w);
+ if (w->interval < MIN_STAT_INTERVAL)
+ w->interval = w->interval ? MIN_STAT_INTERVAL : DEF_STAT_INTERVAL;
+
ev_timer_init (&w->timer, stat_timer_cb, w->interval, w->interval);
ev_set_priority (&w->timer, ev_priority (w));
ev_timer_start (EV_A_ &w->timer);