Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/kqueue.2
Show All 39 Lines | |||||
.Ft int | .Ft int | ||||
.Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout" | .Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout" | ||||
.Fn EV_SET "kev" ident filter flags fflags data udata | .Fn EV_SET "kev" ident filter flags fflags data udata | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn kqueue | .Fn kqueue | ||||
system call | system call | ||||
provides a generic method of notifying the user when an event | provides a generic method of notifying the user when an event | ||||
happens or a condition holds, based on the results of small | happens or a condition holds, based on the results of small | ||||
kib: This is unrelated but the diff is generated from the branch that has split patch, so it is… | |||||
pieces of kernel code termed filters. | pieces of kernel code termed filters. | ||||
A kevent is identified by the (ident, filter) pair; there may only | A kevent is identified by the (ident, filter) pair; there may only | ||||
be one unique kevent per kqueue. | be one unique kevent per kqueue. | ||||
.Pp | .Pp | ||||
The filter is executed upon the initial registration of a kevent | The filter is executed upon the initial registration of a kevent | ||||
in order to detect whether a preexisting condition is present, and is also | in order to detect whether a preexisting condition is present, and is also | ||||
executed whenever an event is passed to the filter for evaluation. | executed whenever an event is passed to the filter for evaluation. | ||||
If the filter determines that the condition should be reported, | If the filter determines that the condition should be reported, | ||||
▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | |||||
returning. | returning. | ||||
.It "BPF devices" | .It "BPF devices" | ||||
Returns when the BPF buffer is full, the BPF timeout has expired, or | Returns when the BPF buffer is full, the BPF timeout has expired, or | ||||
when the BPF has | when the BPF has | ||||
.Dq immediate mode | .Dq immediate mode | ||||
enabled and there is any data to read; | enabled and there is any data to read; | ||||
.Va data | .Va data | ||||
contains the number of bytes available. | contains the number of bytes available. | ||||
.It Eventfds | |||||
Returns when the counter is greater than 0; | |||||
.Va data | |||||
contains the counter value, which must be cast to | |||||
.Vt uint64_t . | |||||
.El | .El | ||||
.It Dv EVFILT_WRITE | .It Dv EVFILT_WRITE | ||||
Takes a descriptor as the identifier, and returns whenever | Takes a descriptor as the identifier, and returns whenever | ||||
it is possible to write to the descriptor. | it is possible to write to the descriptor. | ||||
For sockets, pipes | For sockets, pipes | ||||
and fifos, | and fifos, | ||||
.Va data | .Va data | ||||
will contain the amount of space remaining in the write buffer. | will contain the amount of space remaining in the write buffer. | ||||
The filter will set | The filter will set | ||||
.Dv EV_EOF | .Dv EV_EOF | ||||
when the reader disconnects, and for the fifo case, this will be cleared | when the reader disconnects, and for the fifo case, this will be cleared | ||||
when a new reader connects. | when a new reader connects. | ||||
Note that this filter is not supported for vnodes or BPF devices. | Note that this filter is not supported for vnodes or BPF devices. | ||||
.Pp | .Pp | ||||
For sockets, the low water mark and socket error handling is | For sockets, the low water mark and socket error handling is | ||||
identical to the | identical to the | ||||
.Dv EVFILT_READ | .Dv EVFILT_READ | ||||
case. | case. | ||||
.Pp | |||||
For eventfds, | |||||
.Va data | |||||
will contain the maximum value that can be added to the counter | |||||
without blocking. | |||||
.It Dv EVFILT_EMPTY | .It Dv EVFILT_EMPTY | ||||
Takes a descriptor as the identifier, and returns whenever | Takes a descriptor as the identifier, and returns whenever | ||||
there is no remaining data in the write buffer. | there is no remaining data in the write buffer. | ||||
.It Dv EVFILT_AIO | .It Dv EVFILT_AIO | ||||
Events for this filter are not registered with | Events for this filter are not registered with | ||||
.Fn kevent | .Fn kevent | ||||
directly but are registered via the | directly but are registered via the | ||||
.Va aio_sigevent | .Va aio_sigevent | ||||
▲ Show 20 Lines • Show All 448 Lines • Show Last 20 Lines |
This is unrelated but the diff is generated from the branch that has split patch, so it is separate change in git.