… | |
… | |
42 | #include <stdio.h> |
42 | #include <stdio.h> |
43 | |
43 | |
44 | #include <assert.h> |
44 | #include <assert.h> |
45 | #include <errno.h> |
45 | #include <errno.h> |
46 | #include <sys/types.h> |
46 | #include <sys/types.h> |
|
|
47 | #ifndef WIN32 |
47 | #include <sys/wait.h> |
48 | # include <sys/wait.h> |
|
|
49 | #endif |
48 | #include <sys/time.h> |
50 | #include <sys/time.h> |
49 | #include <time.h> |
51 | #include <time.h> |
50 | |
52 | |
51 | /**/ |
53 | /**/ |
52 | |
54 | |
… | |
… | |
438 | } |
440 | } |
439 | |
441 | |
440 | static void |
442 | static void |
441 | siginit (void) |
443 | siginit (void) |
442 | { |
444 | { |
|
|
445 | #ifndef WIN32 |
443 | fcntl (sigpipe [0], F_SETFD, FD_CLOEXEC); |
446 | fcntl (sigpipe [0], F_SETFD, FD_CLOEXEC); |
444 | fcntl (sigpipe [1], F_SETFD, FD_CLOEXEC); |
447 | fcntl (sigpipe [1], F_SETFD, FD_CLOEXEC); |
445 | |
448 | |
446 | /* rather than sort out wether we really need nb, set it */ |
449 | /* rather than sort out wether we really need nb, set it */ |
447 | fcntl (sigpipe [0], F_SETFL, O_NONBLOCK); |
450 | fcntl (sigpipe [0], F_SETFL, O_NONBLOCK); |
448 | fcntl (sigpipe [1], F_SETFL, O_NONBLOCK); |
451 | fcntl (sigpipe [1], F_SETFL, O_NONBLOCK); |
|
|
452 | #endif |
449 | |
453 | |
450 | ev_io_set (&sigev, sigpipe [0], EV_READ); |
454 | ev_io_set (&sigev, sigpipe [0], EV_READ); |
451 | ev_io_start (&sigev); |
455 | ev_io_start (&sigev); |
452 | } |
456 | } |
453 | |
457 | |
… | |
… | |
464 | |
468 | |
465 | /*****************************************************************************/ |
469 | /*****************************************************************************/ |
466 | |
470 | |
467 | static struct ev_child *childs [PID_HASHSIZE]; |
471 | static struct ev_child *childs [PID_HASHSIZE]; |
468 | static struct ev_signal childev; |
472 | static struct ev_signal childev; |
|
|
473 | |
|
|
474 | #ifndef WIN32 |
469 | |
475 | |
470 | #ifndef WCONTINUED |
476 | #ifndef WCONTINUED |
471 | # define WCONTINUED 0 |
477 | # define WCONTINUED 0 |
472 | #endif |
478 | #endif |
473 | |
479 | |
… | |
… | |
483 | { |
489 | { |
484 | w->status = status; |
490 | w->status = status; |
485 | event ((W)w, EV_CHILD); |
491 | event ((W)w, EV_CHILD); |
486 | } |
492 | } |
487 | } |
493 | } |
|
|
494 | |
|
|
495 | #endif |
488 | |
496 | |
489 | /*****************************************************************************/ |
497 | /*****************************************************************************/ |
490 | |
498 | |
491 | #if EV_USE_KQUEUE |
499 | #if EV_USE_KQUEUE |
492 | # include "ev_kqueue.c" |
500 | # include "ev_kqueue.c" |
… | |
… | |
564 | if (ev_method) |
572 | if (ev_method) |
565 | { |
573 | { |
566 | ev_watcher_init (&sigev, sigcb); |
574 | ev_watcher_init (&sigev, sigcb); |
567 | siginit (); |
575 | siginit (); |
568 | |
576 | |
|
|
577 | #ifndef WIN32 |
569 | ev_signal_init (&childev, childcb, SIGCHLD); |
578 | ev_signal_init (&childev, childcb, SIGCHLD); |
570 | ev_signal_start (&childev); |
579 | ev_signal_start (&childev); |
|
|
580 | #endif |
571 | } |
581 | } |
572 | } |
582 | } |
573 | |
583 | |
574 | return ev_method; |
584 | return ev_method; |
575 | } |
585 | } |