… | |
… | |
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 "2019-06-23" "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" |
… | |
… | |
710 | be well worth enabling it \- if it isn't available in your kernel this will |
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. |
711 | be detected and this backend will be skipped. |
712 | .Sp |
712 | .Sp |
713 | This backend can batch oneshot requests and supports a user-space ring |
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 |
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 |
715 | problems of epoll (such as not being able to remove event sources from the |
716 | the epoll set), and generally sounds too good to be true. Because, this |
716 | epoll set), and generally sounds too good to be true. Because, this being |
717 | being the linux kernel, of course it suffers from a whole new set of |
717 | the linux kernel, of course it suffers from a whole new set of limitations. |
718 | limitations. |
|
|
719 | .Sp |
718 | .Sp |
720 | For one, it is not easily embeddable (but probably could be done using |
719 | For one, it is not easily embeddable (but probably could be done using |
721 | an event fd at some extra overhead). It also is subject to a system wide |
720 | an event fd at some extra overhead). It also is subject to a system wide |
722 | limit that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR \- each loop |
721 | limit that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR \- each loop |
723 | currently requires \f(CW61\fR of this number. If no aio requests are left, this |
722 | currently requires \f(CW61\fR of this number. If no aio requests are left, this |
724 | backend will be skipped during initialisation. |
723 | backend will be skipped during initialisation. |
725 | .Sp |
724 | .Sp |
726 | Most problematic in practise, however, is that not all file descriptors |
725 | Most problematic in practise, however, is that not all file descriptors |
727 | work with it. For example, in linux 5.1, tcp sockets, pipes, event fds, |
726 | work with it. For example, in linux 5.1, tcp sockets, pipes, event fds, |
728 | files, \fI/dev/null\fR and a few others are supported, but ttys do not work |
727 | files, \fI/dev/null\fR and a few others are supported, but ttys do not work |
729 | (probably because of a bug), so this is not (yet?) a generic event polling |
728 | properly (a known bug that the kernel developers don't care about, see |
730 | interface. |
729 | <https://lore.kernel.org/patchwork/patch/1047453/>), so this is not |
|
|
730 | (yet?) a generic event polling interface. |
731 | .Sp |
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 |
732 | To work around this latter problem, the current version of libev uses |
735 | To work around the fd type problem, the current version of libev uses |
733 | epoll as a fallback for file deescriptor types that do not work. Epoll |
736 | epoll as a fallback for file deescriptor types that do not work. Epoll |
734 | is used in, kind of, slow mode that hopefully avoids most of its design |
737 | is used in, kind of, slow mode that hopefully avoids most of its design |
735 | problems and requires 1\-3 extra syscalls per active fd every iteration. |
738 | problems and requires 1\-3 extra syscalls per active fd every iteration. |
736 | .Sp |
739 | .Sp |
737 | 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 |