… | |
… | |
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-22" "libev-4.25" "libev - high performance full featured event loop" |
136 | .TH LIBEV 3 "2019-06-23" "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" |
… | |
… | |
701 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
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. |
702 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
703 | .ie n .IP """EVBACKEND_LINUXAIO"" (value 64, Linux)" 4 |
703 | .ie n .IP """EVBACKEND_LINUXAIO"" (value 64, Linux)" 4 |
704 | .el .IP "\f(CWEVBACKEND_LINUXAIO\fR (value 64, Linux)" 4 |
704 | .el .IP "\f(CWEVBACKEND_LINUXAIO\fR (value 64, Linux)" 4 |
705 | .IX Item "EVBACKEND_LINUXAIO (value 64, Linux)" |
705 | .IX Item "EVBACKEND_LINUXAIO (value 64, Linux)" |
706 | Use the linux-specific linux aio (\fInot\fR \f(CWaio(7)\fR) event interface |
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 | available in post\-4.18 kernels. |
|
|
708 | .Sp |
707 | .Sp |
709 | If this backend works for you (as of this writing, it was very |
708 | If this backend works for you (as of this writing, it was very |
710 | experimental and only supports a subset of file types), it is the best |
709 | experimental), it is the best event interface available on linux and might |
711 | event interface available on linux and might be well worth it enabling it |
710 | be well worth enabling it \- if it isn't available in your kernel this will |
712 | \&\- if it isn't available in your kernel this will be detected and another |
711 | be detected and this backend will be skipped. |
713 | backend will be chosen. |
|
|
714 | .Sp |
712 | .Sp |
715 | This backend can batch oneshot requests and uses a user-space ring buffer |
713 | This backend can batch oneshot requests and supports a user-space ring |
716 | to receive events. It also doesn't suffer from most of the design problems |
714 | buffer to receive events. It also doesn't suffer from most of the design |
717 | of epoll (such as not being able to remove event sources from the epoll |
715 | problems of epoll (such as not being able to remove event sources from |
718 | set), and generally sounds too good to be true. Because, this being the |
716 | the epoll set), and generally sounds too good to be true. Because, this |
719 | linux kernel, of course it suffers from a whole new set of limitations. |
717 | being the linux kernel, of course it suffers from a whole new set of |
|
|
718 | limitations. |
720 | .Sp |
719 | .Sp |
721 | For one, it is not easily embeddable (but probably could be done using |
720 | For one, it is not easily embeddable (but probably could be done using |
722 | an event fd at some extra overhead). It also is subject to various |
721 | an event fd at some extra overhead). It also is subject to a system wide |
723 | arbitrary limits that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR |
722 | limit that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR \- each loop |
724 | and \fI/proc/sys/fs/aio\-nr\fR), which could lead to it being skipped during |
723 | currently requires \f(CW61\fR of this number. If no aio requests are left, this |
725 | initialisation. |
724 | backend will be skipped during initialisation. |
726 | .Sp |
725 | .Sp |
727 | Most problematic in practise, however, is that, like kqueue, it requires |
726 | Most problematic in practise, however, is that not all file descriptors |
728 | special support from drivers, and, not surprisingly, not all drivers |
|
|
729 | implement it. For example, in linux 4.19, tcp sockets, pipes, event fds, |
727 | work with it. For example, in linux 5.1, tcp sockets, pipes, event fds, |
730 | files, \fI/dev/null\fR and a few others are supported, but ttys are not, so |
728 | files, \fI/dev/null\fR and a few others are supported, but ttys do not work |
731 | this is not (yet?) a generic event polling interface but is probably still |
729 | (probably because of a bug), so this is not (yet?) a generic event polling |
732 | be very useful in a web server or similar program. |
730 | interface. |
|
|
731 | .Sp |
|
|
732 | To work around this latter problem, the current version of libev uses |
|
|
733 | 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 |
|
|
735 | problems and requires 1\-3 extra syscalls per active fd every iteration. |
733 | .Sp |
736 | .Sp |
734 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
737 | This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as |
735 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
738 | \&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. |
736 | .ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 |
739 | .ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 |
737 | .el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 |
740 | .el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 |