1 | .\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) |
1 | .\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) |
2 | .\" |
2 | .\" |
3 | .\" Standard preamble: |
3 | .\" Standard preamble: |
4 | .\" ======================================================================== |
4 | .\" ======================================================================== |
5 | .de Sp \" Vertical space (when we can't use .PP) |
5 | .de Sp \" Vertical space (when we can't use .PP) |
6 | .if t .sp .5v |
6 | .if t .sp .5v |
… | |
… | |
44 | .\" |
44 | .\" |
45 | .\" Escape single quotes in literal strings from groff's Unicode transform. |
45 | .\" Escape single quotes in literal strings from groff's Unicode transform. |
46 | .ie \n(.g .ds Aq \(aq |
46 | .ie \n(.g .ds Aq \(aq |
47 | .el .ds Aq ' |
47 | .el .ds Aq ' |
48 | .\" |
48 | .\" |
49 | .\" If the F register is turned on, we'll generate index entries on stderr for |
49 | .\" If the F register is >0, we'll generate index entries on stderr for |
50 | .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
50 | .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
51 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
51 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
52 | .\" output yourself in some meaningful fashion. |
52 | .\" output yourself in some meaningful fashion. |
53 | .\" |
53 | .\" |
54 | .\" Avoid warning from groff about undefined register 'F'. |
54 | .\" Avoid warning from groff about undefined register 'F'. |
55 | .de IX |
55 | .de IX |
56 | .. |
56 | .. |
57 | .nr rF 0 |
57 | .nr rF 0 |
58 | .if \n(.g .if rF .nr rF 1 |
58 | .if \n(.g .if rF .nr rF 1 |
59 | .if (\n(rF:(\n(.g==0)) \{ |
59 | .if (\n(rF:(\n(.g==0)) \{\ |
60 | . if \nF \{ |
60 | . if \nF \{\ |
61 | . de IX |
61 | . de IX |
62 | . tm Index:\\$1\t\\n%\t"\\$2" |
62 | . tm Index:\\$1\t\\n%\t"\\$2" |
63 | .. |
63 | .. |
64 | . if !\nF==2 \{ |
64 | . if !\nF==2 \{\ |
65 | . nr % 0 |
65 | . nr % 0 |
66 | . nr F 2 |
66 | . nr F 2 |
67 | . \} |
67 | . \} |
68 | . \} |
68 | . \} |
69 | .\} |
69 | .\} |
… | |
… | |
131 | .\} |
131 | .\} |
132 | .rm #[ #] #H #V #F C |
132 | .rm #[ #] #H #V #F C |
133 | .\" ======================================================================== |
133 | .\" ======================================================================== |
134 | .\" |
134 | .\" |
135 | .IX Title "LIBEV 3" |
135 | .IX Title "LIBEV 3" |
136 | .TH LIBEV 3 "2018-12-21" "libev-4.25" "libev - high performance full featured event loop" |
136 | .TH LIBEV 3 "2019-06-24" "libev-4.25" "libev - high performance full featured event loop" |
137 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
137 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
138 | .\" way too many mistakes in technical documents. |
138 | .\" way too many mistakes in technical documents. |
139 | .if n .ad l |
139 | .if n .ad l |
140 | .nh |
140 | .nh |
141 | .SH "NAME" |
141 | .SH "NAME" |
… | |
… | |
240 | watchers\fR, which are relatively small C structures you initialise with the |
240 | watchers\fR, which are relatively small C structures you initialise with the |
241 | details of the event, and then hand it over to libev by \fIstarting\fR the |
241 | details of the event, and then hand it over to libev by \fIstarting\fR the |
242 | watcher. |
242 | watcher. |
243 | .SS "\s-1FEATURES\s0" |
243 | .SS "\s-1FEATURES\s0" |
244 | .IX Subsection "FEATURES" |
244 | .IX Subsection "FEATURES" |
245 | Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the Linux-specific \f(CW\*(C`epoll\*(C'\fR, the |
245 | Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the Linux-specific aio and \f(CW\*(C`epoll\*(C'\fR |
246 | BSD-specific \f(CW\*(C`kqueue\*(C'\fR and the Solaris-specific event port mechanisms |
246 | interfaces, the BSD-specific \f(CW\*(C`kqueue\*(C'\fR and the Solaris-specific event port |
247 | for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), the Linux \f(CW\*(C`inotify\*(C'\fR interface |
247 | mechanisms for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), the Linux \f(CW\*(C`inotify\*(C'\fR |
248 | (for \f(CW\*(C`ev_stat\*(C'\fR), Linux eventfd/signalfd (for faster and cleaner |
248 | interface (for \f(CW\*(C`ev_stat\*(C'\fR), Linux eventfd/signalfd (for faster and cleaner |
249 | inter-thread wakeup (\f(CW\*(C`ev_async\*(C'\fR)/signal handling (\f(CW\*(C`ev_signal\*(C'\fR)) relative |
249 | inter-thread wakeup (\f(CW\*(C`ev_async\*(C'\fR)/signal handling (\f(CW\*(C`ev_signal\*(C'\fR)) relative |
250 | timers (\f(CW\*(C`ev_timer\*(C'\fR), absolute timers with customised rescheduling |
250 | timers (\f(CW\*(C`ev_timer\*(C'\fR), absolute timers with customised rescheduling |
251 | (\f(CW\*(C`ev_periodic\*(C'\fR), synchronous signals (\f(CW\*(C`ev_signal\*(C'\fR), process status |
251 | (\f(CW\*(C`ev_periodic\*(C'\fR), synchronous signals (\f(CW\*(C`ev_signal\*(C'\fR), process status |
252 | change events (\f(CW\*(C`ev_child\*(C'\fR), and event watchers dealing with the event |
252 | change events (\f(CW\*(C`ev_child\*(C'\fR), and event watchers dealing with the event |
253 | loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, \f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and |
253 | loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, \f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and |
… | |
… | |
392 | .Sp |
392 | .Sp |
393 | You could override this function in high-availability programs to, say, |
393 | You could override this function in high-availability programs to, say, |
394 | free some memory if it cannot allocate memory, to use a special allocator, |
394 | free some memory if it cannot allocate memory, to use a special allocator, |
395 | or even to sleep a while and retry until some memory is available. |
395 | or even to sleep a while and retry until some memory is available. |
396 | .Sp |
396 | .Sp |
|
|
397 | Example: The following is the \f(CW\*(C`realloc\*(C'\fR function that libev itself uses |
|
|
398 | which should work with \f(CW\*(C`realloc\*(C'\fR and \f(CW\*(C`free\*(C'\fR functions of all kinds and |
|
|
399 | is probably a good basis for your own implementation. |
|
|
400 | .Sp |
|
|
401 | .Vb 5 |
|
|
402 | \& static void * |
|
|
403 | \& ev_realloc_emul (void *ptr, long size) EV_NOEXCEPT |
|
|
404 | \& { |
|
|
405 | \& if (size) |
|
|
406 | \& return realloc (ptr, size); |
|
|
407 | \& |
|
|
408 | \& free (ptr); |
|
|
409 | \& return 0; |
|
|
410 | \& } |
|
|
411 | .Ve |
|
|
412 | .Sp |
397 | Example: Replace the libev allocator with one that waits a bit and then |
413 | Example: Replace the libev allocator with one that waits a bit and then |
398 | retries (example requires a standards-compliant \f(CW\*(C`realloc\*(C'\fR). |
414 | retries. |
399 | .Sp |
415 | .Sp |
400 | .Vb 6 |
416 | .Vb 8 |
401 | \& static void * |
417 | \& static void * |
402 | \& persistent_realloc (void *ptr, size_t size) |
418 | \& persistent_realloc (void *ptr, size_t size) |
403 | \& { |
419 | \& { |
|
|
420 | \& if (!size) |
|
|
421 | \& { |
|
|
422 | \& free (ptr); |
|
|
423 | \& return 0; |
|
|
424 | \& } |
|
|
425 | \& |
404 | \& for (;;) |
426 | \& for (;;) |
405 | \& { |
427 | \& { |
406 | \& void *newptr = realloc (ptr, size); |
428 | \& void *newptr = realloc (ptr, size); |
407 | \& |
429 | \& |
408 | \& if (newptr) |
430 | \& if (newptr) |
… | |
… | |
585 | .Sp |
607 | .Sp |
586 | This flag's behaviour will become the default in future versions of libev. |
608 | This flag's behaviour will become the default in future versions of libev. |
587 | .ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4 |
609 | .ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4 |
588 | .el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4 |
610 | .el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4 |
589 | .IX Item "EVBACKEND_SELECT (value 1, portable select backend)" |
611 | .IX Item "EVBACKEND_SELECT (value 1, portable select backend)" |
590 | This is your standard \fIselect\fR\|(2) backend. Not \fIcompletely\fR standard, as |
612 | This is your standard \fBselect\fR\|(2) backend. Not \fIcompletely\fR standard, as |
591 | libev tries to roll its own fd_set with no limits on the number of fds, |
613 | libev tries to roll its own fd_set with no limits on the number of fds, |
592 | but if that fails, expect a fairly low limit on the number of fds when |
614 | but if that fails, expect a fairly low limit on the number of fds when |
593 | using this backend. It doesn't scale too well (O(highest_fd)), but its |
615 | using this backend. It doesn't scale too well (O(highest_fd)), but its |
594 | usually the fastest backend for a low number of (low-numbered :) fds. |
616 | usually the fastest backend for a low number of (low-numbered :) fds. |
595 | .Sp |
617 | .Sp |
… | |
… | |
604 | \&\f(CW\*(C`writefds\*(C'\fR set (and to work around Microsoft Windows bugs, also onto the |
626 | \&\f(CW\*(C`writefds\*(C'\fR set (and to work around Microsoft Windows bugs, also onto the |
605 | \&\f(CW\*(C`exceptfds\*(C'\fR set on that platform). |
627 | \&\f(CW\*(C`exceptfds\*(C'\fR set on that platform). |
606 | .ie n .IP """EVBACKEND_POLL"" (value 2, poll backend, available everywhere except on windows)" 4 |
628 | .ie n .IP """EVBACKEND_POLL"" (value 2, poll backend, available everywhere except on windows)" 4 |
607 | .el .IP "\f(CWEVBACKEND_POLL\fR (value 2, poll backend, available everywhere except on windows)" 4 |
629 | .el .IP "\f(CWEVBACKEND_POLL\fR (value 2, poll backend, available everywhere except on windows)" 4 |
608 | .IX Item "EVBACKEND_POLL (value 2, poll backend, available everywhere except on windows)" |
630 | .IX Item "EVBACKEND_POLL (value 2, poll backend, available everywhere except on windows)" |
609 | And this is your standard \fIpoll\fR\|(2) backend. It's more complicated |
631 | And this is your standard \fBpoll\fR\|(2) backend. It's more complicated |
610 | than select, but handles sparse fds better and has no artificial |
632 | than select, but handles sparse fds better and has no artificial |
611 | limit on the number of fds you can use (except it will slow down |
633 | limit on the number of fds you can use (except it will slow down |
612 | considerably with a lot of inactive fds). It scales similarly to select, |
634 | considerably with a lot of inactive fds). It scales similarly to select, |
613 | i.e. O(total_fds). See the entry for \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR, above, for |
635 | i.e. O(total_fds). See the entry for \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR, above, for |
614 | performance tips. |
636 | performance tips. |
… | |
… | |
616 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR to \f(CW\*(C`POLLIN | POLLERR | POLLHUP\*(C'\fR, and |
638 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR to \f(CW\*(C`POLLIN | POLLERR | POLLHUP\*(C'\fR, and |
617 | \&\f(CW\*(C`EV_WRITE\*(C'\fR to \f(CW\*(C`POLLOUT | POLLERR | POLLHUP\*(C'\fR. |
639 | \&\f(CW\*(C`EV_WRITE\*(C'\fR to \f(CW\*(C`POLLOUT | POLLERR | POLLHUP\*(C'\fR. |
618 | .ie n .IP """EVBACKEND_EPOLL"" (value 4, Linux)" 4 |
640 | .ie n .IP """EVBACKEND_EPOLL"" (value 4, Linux)" 4 |
619 | .el .IP "\f(CWEVBACKEND_EPOLL\fR (value 4, Linux)" 4 |
641 | .el .IP "\f(CWEVBACKEND_EPOLL\fR (value 4, Linux)" 4 |
620 | .IX Item "EVBACKEND_EPOLL (value 4, Linux)" |
642 | .IX Item "EVBACKEND_EPOLL (value 4, Linux)" |
621 | Use the linux-specific \fIepoll\fR\|(7) interface (for both pre\- and post\-2.6.9 |
643 | Use the linux-specific \fBepoll\fR\|(7) interface (for both pre\- and post\-2.6.9 |
622 | kernels). |
644 | kernels). |
623 | .Sp |
645 | .Sp |
624 | For few fds, this backend is a bit little slower than poll and select, but |
646 | For few fds, this backend is a bit little slower than poll and select, but |
625 | it scales phenomenally better. While poll and select usually scale like |
647 | it scales phenomenally better. While poll and select usually scale like |
626 | O(total_fds) where total_fds is the total number of fds (or the highest |
648 | O(total_fds) where total_fds is the total number of fds (or the highest |
… | |
… | |
672 | All this means that, in practice, \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR can be as fast or |
694 | All this means that, in practice, \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR can be as fast or |
673 | faster than epoll for maybe up to a hundred file descriptors, depending on |
695 | faster than epoll for maybe up to a hundred file descriptors, depending on |
674 | the usage. So sad. |
696 | the usage. So sad. |
675 | .Sp |
697 | .Sp |
676 | While nominally embeddable in other event loops, this feature is broken in |
698 | While nominally embeddable in other event loops, this feature is broken in |
677 | all kernel versions tested so far. |
699 | a lot of kernel revisions, but probably(!) works in current versions. |
|
|
700 | .Sp |
|
|
701 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
|
|
702 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
|
|
703 | .ie n .IP """EVBACKEND_LINUXAIO"" (value 64, Linux)" 4 |
|
|
704 | .el .IP "\f(CWEVBACKEND_LINUXAIO\fR (value 64, Linux)" 4 |
|
|
705 | .IX Item "EVBACKEND_LINUXAIO (value 64, Linux)" |
|
|
706 | Use the linux-specific linux aio (\fInot\fR \f(CWaio(7)\fR but \f(CWio_submit(2)\fR) event interface available in post\-4.18 kernels. |
|
|
707 | .Sp |
|
|
708 | If this backend works for you (as of this writing, it was very |
|
|
709 | experimental), it is the best event interface available on linux and might |
|
|
710 | be well worth enabling it \- if it isn't available in your kernel this will |
|
|
711 | be detected and this backend will be skipped. |
|
|
712 | .Sp |
|
|
713 | This backend can batch oneshot requests and supports a user-space ring |
|
|
714 | buffer to receive events. It also doesn't suffer from most of the design |
|
|
715 | problems of epoll (such as not being able to remove event sources from the |
|
|
716 | epoll set), and generally sounds too good to be true. Because, this being |
|
|
717 | the linux kernel, of course it suffers from a whole new set of limitations. |
|
|
718 | .Sp |
|
|
719 | For one, it is not easily embeddable (but probably could be done using |
|
|
720 | an event fd at some extra overhead). It also is subject to a system wide |
|
|
721 | limit that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR \- each loop |
|
|
722 | currently requires \f(CW61\fR of this number. If no aio requests are left, this |
|
|
723 | backend will be skipped during initialisation. |
|
|
724 | .Sp |
|
|
725 | Most problematic in practise, however, is that not all file descriptors |
|
|
726 | work with it. For example, in linux 5.1, tcp sockets, pipes, event fds, |
|
|
727 | files, \fI/dev/null\fR and a few others are supported, but ttys do not work |
|
|
728 | properly (a known bug that the kernel developers don't care about, see |
|
|
729 | <https://lore.kernel.org/patchwork/patch/1047453/>), so this is not |
|
|
730 | (yet?) a generic event polling interface. |
|
|
731 | .Sp |
|
|
732 | Overall, it seems the linux developers just don't want it to have a |
|
|
733 | generic event handling mechanism other than \f(CW\*(C`select\*(C'\fR or \f(CW\*(C`poll\*(C'\fR. |
|
|
734 | .Sp |
|
|
735 | To work around the fd type problem, the current version of libev uses |
|
|
736 | epoll as a fallback for file deescriptor types that do not work. Epoll |
|
|
737 | is used in, kind of, slow mode that hopefully avoids most of its design |
|
|
738 | problems and requires 1\-3 extra syscalls per active fd every iteration. |
678 | .Sp |
739 | .Sp |
679 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
740 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
680 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
741 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
681 | .ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 |
742 | .ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 |
682 | .el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 |
743 | .el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 |
… | |
… | |
785 | Example: Use whatever libev has to offer, but make sure that kqueue is |
846 | Example: Use whatever libev has to offer, but make sure that kqueue is |
786 | used if available. |
847 | used if available. |
787 | .Sp |
848 | .Sp |
788 | .Vb 1 |
849 | .Vb 1 |
789 | \& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_KQUEUE); |
850 | \& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_KQUEUE); |
|
|
851 | .Ve |
|
|
852 | .Sp |
|
|
853 | Example: Similarly, on linux, you mgiht want to take advantage of the |
|
|
854 | linux aio backend if possible, but fall back to something else if that |
|
|
855 | isn't available. |
|
|
856 | .Sp |
|
|
857 | .Vb 1 |
|
|
858 | \& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_LINUXAIO); |
790 | .Ve |
859 | .Ve |
791 | .RE |
860 | .RE |
792 | .IP "ev_loop_destroy (loop)" 4 |
861 | .IP "ev_loop_destroy (loop)" 4 |
793 | .IX Item "ev_loop_destroy (loop)" |
862 | .IX Item "ev_loop_destroy (loop)" |
794 | Destroys an event loop object (frees all memory and kernel state |
863 | Destroys an event loop object (frees all memory and kernel state |
… | |
… | |
1365 | bug in your program. |
1434 | bug in your program. |
1366 | .Sp |
1435 | .Sp |
1367 | Libev will usually signal a few \*(L"dummy\*(R" events together with an error, for |
1436 | Libev will usually signal a few \*(L"dummy\*(R" events together with an error, for |
1368 | example it might indicate that a fd is readable or writable, and if your |
1437 | example it might indicate that a fd is readable or writable, and if your |
1369 | callbacks is well-written it can just attempt the operation and cope with |
1438 | callbacks is well-written it can just attempt the operation and cope with |
1370 | the error from \fIread()\fR or \fIwrite()\fR. This will not work in multi-threaded |
1439 | the error from \fBread()\fR or \fBwrite()\fR. This will not work in multi-threaded |
1371 | programs, though, as the fd could already be closed and reused for another |
1440 | programs, though, as the fd could already be closed and reused for another |
1372 | thing, so beware. |
1441 | thing, so beware. |
1373 | .SS "\s-1GENERIC WATCHER FUNCTIONS\s0" |
1442 | .SS "\s-1GENERIC WATCHER FUNCTIONS\s0" |
1374 | .IX Subsection "GENERIC WATCHER FUNCTIONS" |
1443 | .IX Subsection "GENERIC WATCHER FUNCTIONS" |
1375 | .ie n .IP """ev_init"" (ev_TYPE *watcher, callback)" 4 |
1444 | .ie n .IP """ev_init"" (ev_TYPE *watcher, callback)" 4 |
… | |
… | |
1726 | But really, best use non-blocking mode. |
1795 | But really, best use non-blocking mode. |
1727 | .PP |
1796 | .PP |
1728 | \fIThe special problem of disappearing file descriptors\fR |
1797 | \fIThe special problem of disappearing file descriptors\fR |
1729 | .IX Subsection "The special problem of disappearing file descriptors" |
1798 | .IX Subsection "The special problem of disappearing file descriptors" |
1730 | .PP |
1799 | .PP |
1731 | Some backends (e.g. kqueue, epoll) need to be told about closing a file |
1800 | Some backends (e.g. kqueue, epoll, linuxaio) need to be told about closing |
1732 | descriptor (either due to calling \f(CW\*(C`close\*(C'\fR explicitly or any other means, |
1801 | a file descriptor (either due to calling \f(CW\*(C`close\*(C'\fR explicitly or any other |
1733 | such as \f(CW\*(C`dup2\*(C'\fR). The reason is that you register interest in some file |
1802 | means, such as \f(CW\*(C`dup2\*(C'\fR). The reason is that you register interest in some |
1734 | descriptor, but when it goes away, the operating system will silently drop |
1803 | file descriptor, but when it goes away, the operating system will silently |
1735 | this interest. If another file descriptor with the same number then is |
1804 | drop this interest. If another file descriptor with the same number then |
1736 | registered with libev, there is no efficient way to see that this is, in |
1805 | is registered with libev, there is no efficient way to see that this is, |
1737 | fact, a different file descriptor. |
1806 | in fact, a different file descriptor. |
1738 | .PP |
1807 | .PP |
1739 | To avoid having to explicitly tell libev about such cases, libev follows |
1808 | To avoid having to explicitly tell libev about such cases, libev follows |
1740 | the following policy: Each time \f(CW\*(C`ev_io_set\*(C'\fR is being called, libev |
1809 | the following policy: Each time \f(CW\*(C`ev_io_set\*(C'\fR is being called, libev |
1741 | will assume that this is potentially a new file descriptor, otherwise |
1810 | will assume that this is potentially a new file descriptor, otherwise |
1742 | it is assumed that the file descriptor stays the same. That means that |
1811 | it is assumed that the file descriptor stays the same. That means that |
… | |
… | |
1794 | reuse the same code path. |
1863 | reuse the same code path. |
1795 | .PP |
1864 | .PP |
1796 | \fIThe special problem of fork\fR |
1865 | \fIThe special problem of fork\fR |
1797 | .IX Subsection "The special problem of fork" |
1866 | .IX Subsection "The special problem of fork" |
1798 | .PP |
1867 | .PP |
1799 | Some backends (epoll, kqueue) do not support \f(CW\*(C`fork ()\*(C'\fR at all or exhibit |
1868 | Some backends (epoll, kqueue, probably linuxaio) do not support \f(CW\*(C`fork ()\*(C'\fR |
1800 | useless behaviour. Libev fully supports fork, but needs to be told about |
1869 | at all or exhibit useless behaviour. Libev fully supports fork, but needs |
1801 | it in the child if you want to continue to use it in the child. |
1870 | to be told about it in the child if you want to continue to use it in the |
|
|
1871 | child. |
1802 | .PP |
1872 | .PP |
1803 | To support fork in your child processes, you have to call \f(CW\*(C`ev_loop_fork |
1873 | To support fork in your child processes, you have to call \f(CW\*(C`ev_loop_fork |
1804 | ()\*(C'\fR after a fork in the child, enable \f(CW\*(C`EVFLAG_FORKCHECK\*(C'\fR, or resort to |
1874 | ()\*(C'\fR after a fork in the child, enable \f(CW\*(C`EVFLAG_FORKCHECK\*(C'\fR, or resort to |
1805 | \&\f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
1875 | \&\f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
1806 | .PP |
1876 | .PP |
… | |
… | |
1811 | when writing to a pipe whose other end has been closed, your program gets |
1881 | when writing to a pipe whose other end has been closed, your program gets |
1812 | sent a \s-1SIGPIPE,\s0 which, by default, aborts your program. For most programs |
1882 | sent a \s-1SIGPIPE,\s0 which, by default, aborts your program. For most programs |
1813 | this is sensible behaviour, for daemons, this is usually undesirable. |
1883 | this is sensible behaviour, for daemons, this is usually undesirable. |
1814 | .PP |
1884 | .PP |
1815 | So when you encounter spurious, unexplained daemon exits, make sure you |
1885 | So when you encounter spurious, unexplained daemon exits, make sure you |
1816 | ignore \s-1SIGPIPE \s0(and maybe make sure you log the exit status of your daemon |
1886 | ignore \s-1SIGPIPE\s0 (and maybe make sure you log the exit status of your daemon |
1817 | somewhere, as that would have given you a big clue). |
1887 | somewhere, as that would have given you a big clue). |
1818 | .PP |
1888 | .PP |
1819 | \fIThe special problem of \fIaccept()\fIing when you can't\fR |
1889 | \fIThe special problem of \f(BIaccept()\fIing when you can't\fR |
1820 | .IX Subsection "The special problem of accept()ing when you can't" |
1890 | .IX Subsection "The special problem of accept()ing when you can't" |
1821 | .PP |
1891 | .PP |
1822 | Many implementations of the \s-1POSIX \s0\f(CW\*(C`accept\*(C'\fR function (for example, |
1892 | Many implementations of the \s-1POSIX\s0 \f(CW\*(C`accept\*(C'\fR function (for example, |
1823 | found in post\-2004 Linux) have the peculiar behaviour of not removing a |
1893 | found in post\-2004 Linux) have the peculiar behaviour of not removing a |
1824 | connection from the pending queue in all error cases. |
1894 | connection from the pending queue in all error cases. |
1825 | .PP |
1895 | .PP |
1826 | For example, larger servers often run out of file descriptors (because |
1896 | For example, larger servers often run out of file descriptors (because |
1827 | of resource limits), causing \f(CW\*(C`accept\*(C'\fR to fail with \f(CW\*(C`ENFILE\*(C'\fR but not |
1897 | of resource limits), causing \f(CW\*(C`accept\*(C'\fR to fail with \f(CW\*(C`ENFILE\*(C'\fR but not |
… | |
… | |
2434 | In this mode the values for \f(CW\*(C`interval\*(C'\fR and \f(CW\*(C`offset\*(C'\fR are both being |
2504 | In this mode the values for \f(CW\*(C`interval\*(C'\fR and \f(CW\*(C`offset\*(C'\fR are both being |
2435 | ignored. Instead, each time the periodic watcher gets scheduled, the |
2505 | ignored. Instead, each time the periodic watcher gets scheduled, the |
2436 | reschedule callback will be called with the watcher as first, and the |
2506 | reschedule callback will be called with the watcher as first, and the |
2437 | current time as second argument. |
2507 | current time as second argument. |
2438 | .Sp |
2508 | .Sp |
2439 | \&\s-1NOTE: \s0\fIThis callback \s-1MUST NOT\s0 stop or destroy any periodic watcher, ever, |
2509 | \&\s-1NOTE:\s0 \fIThis callback \s-1MUST NOT\s0 stop or destroy any periodic watcher, ever, |
2440 | or make \s-1ANY\s0 other event loop modifications whatsoever, unless explicitly |
2510 | or make \s-1ANY\s0 other event loop modifications whatsoever, unless explicitly |
2441 | allowed by documentation here\fR. |
2511 | allowed by documentation here\fR. |
2442 | .Sp |
2512 | .Sp |
2443 | If you need to stop it, return \f(CW\*(C`now + 1e30\*(C'\fR (or so, fudge fudge) and stop |
2513 | If you need to stop it, return \f(CW\*(C`now + 1e30\*(C'\fR (or so, fudge fudge) and stop |
2444 | it afterwards (e.g. by starting an \f(CW\*(C`ev_prepare\*(C'\fR watcher, which is the |
2514 | it afterwards (e.g. by starting an \f(CW\*(C`ev_prepare\*(C'\fR watcher, which is the |
… | |
… | |
2458 | It must return the next time to trigger, based on the passed time value |
2528 | It must return the next time to trigger, based on the passed time value |
2459 | (that is, the lowest time value larger than to the second argument). It |
2529 | (that is, the lowest time value larger than to the second argument). It |
2460 | will usually be called just before the callback will be triggered, but |
2530 | will usually be called just before the callback will be triggered, but |
2461 | might be called at other times, too. |
2531 | might be called at other times, too. |
2462 | .Sp |
2532 | .Sp |
2463 | \&\s-1NOTE: \s0\fIThis callback must always return a time that is higher than or |
2533 | \&\s-1NOTE:\s0 \fIThis callback must always return a time that is higher than or |
2464 | equal to the passed \f(CI\*(C`now\*(C'\fI value\fR. |
2534 | equal to the passed \f(CI\*(C`now\*(C'\fI value\fR. |
2465 | .Sp |
2535 | .Sp |
2466 | This can be used to create very complex timers, such as a timer that |
2536 | This can be used to create very complex timers, such as a timer that |
2467 | triggers on \*(L"next midnight, local time\*(R". To do this, you would calculate |
2537 | triggers on \*(L"next midnight, local time\*(R". To do this, you would calculate |
2468 | the next midnight after \f(CW\*(C`now\*(C'\fR and return the timestamp value for |
2538 | the next midnight after \f(CW\*(C`now\*(C'\fR and return the timestamp value for |
… | |
… | |
2613 | The simplest way to ensure that the signal mask is reset in the child is |
2683 | The simplest way to ensure that the signal mask is reset in the child is |
2614 | to install a fork handler with \f(CW\*(C`pthread_atfork\*(C'\fR that resets it. That will |
2684 | to install a fork handler with \f(CW\*(C`pthread_atfork\*(C'\fR that resets it. That will |
2615 | catch fork calls done by libraries (such as the libc) as well. |
2685 | catch fork calls done by libraries (such as the libc) as well. |
2616 | .PP |
2686 | .PP |
2617 | In current versions of libev, the signal will not be blocked indefinitely |
2687 | In current versions of libev, the signal will not be blocked indefinitely |
2618 | unless you use the \f(CW\*(C`signalfd\*(C'\fR \s-1API \s0(\f(CW\*(C`EV_SIGNALFD\*(C'\fR). While this reduces |
2688 | unless you use the \f(CW\*(C`signalfd\*(C'\fR \s-1API\s0 (\f(CW\*(C`EV_SIGNALFD\*(C'\fR). While this reduces |
2619 | the window of opportunity for problems, it will not go away, as libev |
2689 | the window of opportunity for problems, it will not go away, as libev |
2620 | \&\fIhas\fR to modify the signal mask, at least temporarily. |
2690 | \&\fIhas\fR to modify the signal mask, at least temporarily. |
2621 | .PP |
2691 | .PP |
2622 | So I can't stress this enough: \fIIf you do not reset your signal mask when |
2692 | So I can't stress this enough: \fIIf you do not reset your signal mask when |
2623 | you expect it to be empty, you have a race condition in your code\fR. This |
2693 | you expect it to be empty, you have a race condition in your code\fR. This |
… | |
… | |
4518 | \& #include "ev.c" |
4588 | \& #include "ev.c" |
4519 | .Ve |
4589 | .Ve |
4520 | .PP |
4590 | .PP |
4521 | This will automatically include \fIev.h\fR, too, and should be done in a |
4591 | This will automatically include \fIev.h\fR, too, and should be done in a |
4522 | single C source file only to provide the function implementations. To use |
4592 | single C source file only to provide the function implementations. To use |
4523 | it, do the same for \fIev.h\fR in all files wishing to use this \s-1API \s0(best |
4593 | it, do the same for \fIev.h\fR in all files wishing to use this \s-1API\s0 (best |
4524 | done by writing a wrapper around \fIev.h\fR that you can include instead and |
4594 | done by writing a wrapper around \fIev.h\fR that you can include instead and |
4525 | where you can put other configuration options): |
4595 | where you can put other configuration options): |
4526 | .PP |
4596 | .PP |
4527 | .Vb 2 |
4597 | .Vb 2 |
4528 | \& #define EV_STANDALONE 1 |
4598 | \& #define EV_STANDALONE 1 |
… | |
… | |
4545 | \& ev_win32.c required on win32 platforms only |
4615 | \& ev_win32.c required on win32 platforms only |
4546 | \& |
4616 | \& |
4547 | \& ev_select.c only when select backend is enabled |
4617 | \& ev_select.c only when select backend is enabled |
4548 | \& ev_poll.c only when poll backend is enabled |
4618 | \& ev_poll.c only when poll backend is enabled |
4549 | \& ev_epoll.c only when the epoll backend is enabled |
4619 | \& ev_epoll.c only when the epoll backend is enabled |
|
|
4620 | \& ev_linuxaio.c only when the linux aio backend is enabled |
4550 | \& ev_kqueue.c only when the kqueue backend is enabled |
4621 | \& ev_kqueue.c only when the kqueue backend is enabled |
4551 | \& ev_port.c only when the solaris port backend is enabled |
4622 | \& ev_port.c only when the solaris port backend is enabled |
4552 | .Ve |
4623 | .Ve |
4553 | .PP |
4624 | .PP |
4554 | \&\fIev.c\fR includes the backend files directly when enabled, so you only need |
4625 | \&\fIev.c\fR includes the backend files directly when enabled, so you only need |
… | |
… | |
4601 | values when compiling libev vs. including \fIev.h\fR, so it is permissible |
4672 | values when compiling libev vs. including \fIev.h\fR, so it is permissible |
4602 | to redefine them before including \fIev.h\fR without breaking compatibility |
4673 | to redefine them before including \fIev.h\fR without breaking compatibility |
4603 | to a compiled library. All other symbols change the \s-1ABI,\s0 which means all |
4674 | to a compiled library. All other symbols change the \s-1ABI,\s0 which means all |
4604 | users of libev and the libev code itself must be compiled with compatible |
4675 | users of libev and the libev code itself must be compiled with compatible |
4605 | settings. |
4676 | settings. |
4606 | .IP "\s-1EV_COMPAT3 \s0(h)" 4 |
4677 | .IP "\s-1EV_COMPAT3\s0 (h)" 4 |
4607 | .IX Item "EV_COMPAT3 (h)" |
4678 | .IX Item "EV_COMPAT3 (h)" |
4608 | Backwards compatibility is a major concern for libev. This is why this |
4679 | Backwards compatibility is a major concern for libev. This is why this |
4609 | release of libev comes with wrappers for the functions and symbols that |
4680 | release of libev comes with wrappers for the functions and symbols that |
4610 | have been renamed between libev version 3 and 4. |
4681 | have been renamed between libev version 3 and 4. |
4611 | .Sp |
4682 | .Sp |
… | |
… | |
4616 | typedef in that case. |
4687 | typedef in that case. |
4617 | .Sp |
4688 | .Sp |
4618 | In some future version, the default for \f(CW\*(C`EV_COMPAT3\*(C'\fR will become \f(CW0\fR, |
4689 | In some future version, the default for \f(CW\*(C`EV_COMPAT3\*(C'\fR will become \f(CW0\fR, |
4619 | and in some even more future version the compatibility code will be |
4690 | and in some even more future version the compatibility code will be |
4620 | removed completely. |
4691 | removed completely. |
4621 | .IP "\s-1EV_STANDALONE \s0(h)" 4 |
4692 | .IP "\s-1EV_STANDALONE\s0 (h)" 4 |
4622 | .IX Item "EV_STANDALONE (h)" |
4693 | .IX Item "EV_STANDALONE (h)" |
4623 | Must always be \f(CW1\fR if you do not use autoconf configuration, which |
4694 | Must always be \f(CW1\fR if you do not use autoconf configuration, which |
4624 | keeps libev from including \fIconfig.h\fR, and it also defines dummy |
4695 | keeps libev from including \fIconfig.h\fR, and it also defines dummy |
4625 | implementations for some libevent functions (such as logging, which is not |
4696 | implementations for some libevent functions (such as logging, which is not |
4626 | supported). It will also not define any of the structs usually found in |
4697 | supported). It will also not define any of the structs usually found in |
… | |
… | |
4735 | If defined to be \f(CW1\fR, libev will compile in support for the Linux |
4806 | If defined to be \f(CW1\fR, libev will compile in support for the Linux |
4736 | \&\f(CW\*(C`epoll\*(C'\fR(7) backend. Its availability will be detected at runtime, |
4807 | \&\f(CW\*(C`epoll\*(C'\fR(7) backend. Its availability will be detected at runtime, |
4737 | otherwise another method will be used as fallback. This is the preferred |
4808 | otherwise another method will be used as fallback. This is the preferred |
4738 | backend for GNU/Linux systems. If undefined, it will be enabled if the |
4809 | backend for GNU/Linux systems. If undefined, it will be enabled if the |
4739 | headers indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. |
4810 | headers indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. |
|
|
4811 | .IP "\s-1EV_USE_LINUXAIO\s0" 4 |
|
|
4812 | .IX Item "EV_USE_LINUXAIO" |
|
|
4813 | If defined to be \f(CW1\fR, libev will compile in support for the Linux |
|
|
4814 | aio backend. Due to it's currenbt limitations it has to be requested |
|
|
4815 | explicitly. If undefined, it will be enabled on linux, otherwise |
|
|
4816 | disabled. |
4740 | .IP "\s-1EV_USE_KQUEUE\s0" 4 |
4817 | .IP "\s-1EV_USE_KQUEUE\s0" 4 |
4741 | .IX Item "EV_USE_KQUEUE" |
4818 | .IX Item "EV_USE_KQUEUE" |
4742 | If defined to be \f(CW1\fR, libev will compile in support for the \s-1BSD\s0 style |
4819 | If defined to be \f(CW1\fR, libev will compile in support for the \s-1BSD\s0 style |
4743 | \&\f(CW\*(C`kqueue\*(C'\fR(2) backend. Its actual availability will be detected at runtime, |
4820 | \&\f(CW\*(C`kqueue\*(C'\fR(2) backend. Its actual availability will be detected at runtime, |
4744 | otherwise another method will be used as fallback. This is the preferred |
4821 | otherwise another method will be used as fallback. This is the preferred |
… | |
… | |
4784 | handler \*(L"locking\*(R" as well as for signal and thread safety in \f(CW\*(C`ev_async\*(C'\fR |
4861 | handler \*(L"locking\*(R" as well as for signal and thread safety in \f(CW\*(C`ev_async\*(C'\fR |
4785 | watchers. |
4862 | watchers. |
4786 | .Sp |
4863 | .Sp |
4787 | In the absence of this define, libev will use \f(CW\*(C`sig_atomic_t volatile\*(C'\fR |
4864 | In the absence of this define, libev will use \f(CW\*(C`sig_atomic_t volatile\*(C'\fR |
4788 | (from \fIsignal.h\fR), which is usually good enough on most platforms. |
4865 | (from \fIsignal.h\fR), which is usually good enough on most platforms. |
4789 | .IP "\s-1EV_H \s0(h)" 4 |
4866 | .IP "\s-1EV_H\s0 (h)" 4 |
4790 | .IX Item "EV_H (h)" |
4867 | .IX Item "EV_H (h)" |
4791 | The name of the \fIev.h\fR header file used to include it. The default if |
4868 | The name of the \fIev.h\fR header file used to include it. The default if |
4792 | undefined is \f(CW"ev.h"\fR in \fIevent.h\fR, \fIev.c\fR and \fIev++.h\fR. This can be |
4869 | undefined is \f(CW"ev.h"\fR in \fIevent.h\fR, \fIev.c\fR and \fIev++.h\fR. This can be |
4793 | used to virtually rename the \fIev.h\fR header file in case of conflicts. |
4870 | used to virtually rename the \fIev.h\fR header file in case of conflicts. |
4794 | .IP "\s-1EV_CONFIG_H \s0(h)" 4 |
4871 | .IP "\s-1EV_CONFIG_H\s0 (h)" 4 |
4795 | .IX Item "EV_CONFIG_H (h)" |
4872 | .IX Item "EV_CONFIG_H (h)" |
4796 | If \f(CW\*(C`EV_STANDALONE\*(C'\fR isn't \f(CW1\fR, this variable can be used to override |
4873 | If \f(CW\*(C`EV_STANDALONE\*(C'\fR isn't \f(CW1\fR, this variable can be used to override |
4797 | \&\fIev.c\fR's idea of where to find the \fIconfig.h\fR file, similarly to |
4874 | \&\fIev.c\fR's idea of where to find the \fIconfig.h\fR file, similarly to |
4798 | \&\f(CW\*(C`EV_H\*(C'\fR, above. |
4875 | \&\f(CW\*(C`EV_H\*(C'\fR, above. |
4799 | .IP "\s-1EV_EVENT_H \s0(h)" 4 |
4876 | .IP "\s-1EV_EVENT_H\s0 (h)" 4 |
4800 | .IX Item "EV_EVENT_H (h)" |
4877 | .IX Item "EV_EVENT_H (h)" |
4801 | Similarly to \f(CW\*(C`EV_H\*(C'\fR, this macro can be used to override \fIevent.c\fR's idea |
4878 | Similarly to \f(CW\*(C`EV_H\*(C'\fR, this macro can be used to override \fIevent.c\fR's idea |
4802 | of how the \fIevent.h\fR header can be found, the default is \f(CW"event.h"\fR. |
4879 | of how the \fIevent.h\fR header can be found, the default is \f(CW"event.h"\fR. |
4803 | .IP "\s-1EV_PROTOTYPES \s0(h)" 4 |
4880 | .IP "\s-1EV_PROTOTYPES\s0 (h)" 4 |
4804 | .IX Item "EV_PROTOTYPES (h)" |
4881 | .IX Item "EV_PROTOTYPES (h)" |
4805 | If defined to be \f(CW0\fR, then \fIev.h\fR will not define any function |
4882 | If defined to be \f(CW0\fR, then \fIev.h\fR will not define any function |
4806 | prototypes, but still define all the structs and other symbols. This is |
4883 | prototypes, but still define all the structs and other symbols. This is |
4807 | occasionally useful if you want to provide your own wrapper functions |
4884 | occasionally useful if you want to provide your own wrapper functions |
4808 | around libev functions. |
4885 | around libev functions. |
… | |
… | |
5017 | .Vb 3 |
5094 | .Vb 3 |
5018 | \& #define EV_COMMON \e |
5095 | \& #define EV_COMMON \e |
5019 | \& SV *self; /* contains this struct */ \e |
5096 | \& SV *self; /* contains this struct */ \e |
5020 | \& SV *cb_sv, *fh /* note no trailing ";" */ |
5097 | \& SV *cb_sv, *fh /* note no trailing ";" */ |
5021 | .Ve |
5098 | .Ve |
5022 | .IP "\s-1EV_CB_DECLARE \s0(type)" 4 |
5099 | .IP "\s-1EV_CB_DECLARE\s0 (type)" 4 |
5023 | .IX Item "EV_CB_DECLARE (type)" |
5100 | .IX Item "EV_CB_DECLARE (type)" |
5024 | .PD 0 |
5101 | .PD 0 |
5025 | .IP "\s-1EV_CB_INVOKE \s0(watcher, revents)" 4 |
5102 | .IP "\s-1EV_CB_INVOKE\s0 (watcher, revents)" 4 |
5026 | .IX Item "EV_CB_INVOKE (watcher, revents)" |
5103 | .IX Item "EV_CB_INVOKE (watcher, revents)" |
5027 | .IP "ev_set_cb (ev, cb)" 4 |
5104 | .IP "ev_set_cb (ev, cb)" 4 |
5028 | .IX Item "ev_set_cb (ev, cb)" |
5105 | .IX Item "ev_set_cb (ev, cb)" |
5029 | .PD |
5106 | .PD |
5030 | Can be used to change the callback member declaration in each watcher, |
5107 | Can be used to change the callback member declaration in each watcher, |
… | |
… | |
5033 | their default definitions. One possible use for overriding these is to |
5110 | their default definitions. One possible use for overriding these is to |
5034 | avoid the \f(CW\*(C`struct ev_loop *\*(C'\fR as first argument in all cases, or to use |
5111 | avoid the \f(CW\*(C`struct ev_loop *\*(C'\fR as first argument in all cases, or to use |
5035 | method calls instead of plain function calls in \*(C+. |
5112 | method calls instead of plain function calls in \*(C+. |
5036 | .SS "\s-1EXPORTED API SYMBOLS\s0" |
5113 | .SS "\s-1EXPORTED API SYMBOLS\s0" |
5037 | .IX Subsection "EXPORTED API SYMBOLS" |
5114 | .IX Subsection "EXPORTED API SYMBOLS" |
5038 | If you need to re-export the \s-1API \s0(e.g. via a \s-1DLL\s0) and you need a list of |
5115 | If you need to re-export the \s-1API\s0 (e.g. via a \s-1DLL\s0) and you need a list of |
5039 | exported symbols, you can use the provided \fISymbol.*\fR files which list |
5116 | exported symbols, you can use the provided \fISymbol.*\fR files which list |
5040 | all public symbols, one per line: |
5117 | all public symbols, one per line: |
5041 | .PP |
5118 | .PP |
5042 | .Vb 2 |
5119 | .Vb 2 |
5043 | \& Symbols.ev for libev proper |
5120 | \& Symbols.ev for libev proper |
… | |
… | |
5275 | .PP |
5352 | .PP |
5276 | \fI\f(CI\*(C`select\*(C'\fI is buggy\fR |
5353 | \fI\f(CI\*(C`select\*(C'\fI is buggy\fR |
5277 | .IX Subsection "select is buggy" |
5354 | .IX Subsection "select is buggy" |
5278 | .PP |
5355 | .PP |
5279 | All that's left is \f(CW\*(C`select\*(C'\fR, and of course Apple found a way to fuck this |
5356 | All that's left is \f(CW\*(C`select\*(C'\fR, and of course Apple found a way to fuck this |
5280 | one up as well: On \s-1OS/X, \s0\f(CW\*(C`select\*(C'\fR actively limits the number of file |
5357 | one up as well: On \s-1OS/X,\s0 \f(CW\*(C`select\*(C'\fR actively limits the number of file |
5281 | descriptors you can pass in to 1024 \- your program suddenly crashes when |
5358 | descriptors you can pass in to 1024 \- your program suddenly crashes when |
5282 | you use more. |
5359 | you use more. |
5283 | .PP |
5360 | .PP |
5284 | There is an undocumented \*(L"workaround\*(R" for this \- defining |
5361 | There is an undocumented \*(L"workaround\*(R" for this \- defining |
5285 | \&\f(CW\*(C`_DARWIN_UNLIMITED_SELECT\*(C'\fR, which libev tries to use, so select \fIshould\fR |
5362 | \&\f(CW\*(C`_DARWIN_UNLIMITED_SELECT\*(C'\fR, which libev tries to use, so select \fIshould\fR |