Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/kqueue.2
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
argument should be non-NULL, pointing to a zero-valued | argument should be non-NULL, pointing to a zero-valued | ||||
.Va timespec | .Va timespec | ||||
structure. | structure. | ||||
The same array may be used for the | The same array may be used for the | ||||
.Fa changelist | .Fa changelist | ||||
and | and | ||||
.Fa eventlist . | .Fa eventlist . | ||||
.Pp | .Pp | ||||
The special value | |||||
.Va KQUEUE_FD_ANON | |||||
may be given as the | |||||
.Va fd | |||||
argument to | |||||
.Fn kevent . | |||||
In this case, an anonymous temporary queue is used, and no longer exists | |||||
after the call returns. | |||||
.Pp | |||||
The | The | ||||
.Fn EV_SET | .Fn EV_SET | ||||
macro is provided for ease of initializing a | macro is provided for ease of initializing a | ||||
kevent structure. | kevent structure. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Va kevent | .Va kevent | ||||
structure is defined as: | structure is defined as: | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
Note that some filters may automatically | Note that some filters may automatically | ||||
set this flag internally. | set this flag internally. | ||||
.It Dv EV_EOF | .It Dv EV_EOF | ||||
Filters may set this flag to indicate filter-specific EOF condition. | Filters may set this flag to indicate filter-specific EOF condition. | ||||
.It Dv EV_ERROR | .It Dv EV_ERROR | ||||
See | See | ||||
.Sx RETURN VALUES | .Sx RETURN VALUES | ||||
below. | below. | ||||
.It Dv EV_ANON | |||||
This is used for anonymous operations that are not associated with a particular | |||||
kqueue descriptor. | |||||
.It Dv EV_KEEPUDATA | .It Dv EV_KEEPUDATA | ||||
Causes | Causes | ||||
.Fn kevent | .Fn kevent | ||||
to leave unchanged any | to leave unchanged any | ||||
.Fa udata | .Fa udata | ||||
associated with an existing event. | associated with an existing event. | ||||
This allows other aspects of the event to be modified without requiring the | This allows other aspects of the event to be modified without requiring the | ||||
caller to know the | caller to know the | ||||
▲ Show 20 Lines • Show All 384 Lines • ▼ Show 20 Lines | |||||
.Bl -tag -width "Dv NOTE_FFLAGSMASK" | .Bl -tag -width "Dv NOTE_FFLAGSMASK" | ||||
.It Dv NOTE_TRIGGER | .It Dv NOTE_TRIGGER | ||||
Cause the event to be triggered. | Cause the event to be triggered. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
On return, | On return, | ||||
.Va fflags | .Va fflags | ||||
contains the users defined flags in the lower 24 bits. | contains the users defined flags in the lower 24 bits. | ||||
.It Dv EVFILT_USERMEM | |||||
Waits for a value to change at an address in user memory. The address | |||||
is provided in | |||||
.Va ident . | |||||
The value it points to is compared with an expected value provided in | |||||
.Va data , | |||||
and the event is triggered immediately if they are not equal. Otherwise, it | |||||
must be triggered explicitly using | |||||
.Va NOTE_TRIGGER | |||||
by any thread that wants to advertise that it has changed the value. The event | |||||
can be triggered by any process that has the same memory object mapped, even at | |||||
a different address, unless | |||||
.Va NOTE_USERMEM_PRIVATE | |||||
is added to | |||||
.Va fflags | |||||
to prevent inter-process events. | |||||
When | |||||
.Va NOTE_TRIGGER | |||||
is used in | |||||
.Va fflags , | |||||
.Va flags | |||||
should be set to | |||||
.Va EV_ANON , | |||||
because this operation wakes waiters not only in the given kqueue object. | |||||
.Bl -tag -width "Dv NOTE_UMTX_WAIT_PRIVATE" | |||||
.It Dv NOTE_USERMEM_INT | |||||
.Va ident | |||||
points to an object the size of an integer. | |||||
.It Dv NOTE_USERMEM_LONG | |||||
.Va ident | |||||
points to an object the size of a long. | |||||
.It Dv NOTE_TRIGGER | |||||
Cause the event to be triggered. The number of waiters to wake up should | |||||
be provided in | |||||
.Va data . | |||||
.It Dv NOTE_USERMEM_PRIVATE | |||||
.Va ident | |||||
is in a private namespace that is not shared with other processes that map | |||||
the containing memory object. Can be ORed with the preceding values. | |||||
.El | |||||
.El | .El | ||||
.Sh CANCELLATION BEHAVIOUR | .Sh CANCELLATION BEHAVIOUR | ||||
If | If | ||||
.Fa nevents | .Fa nevents | ||||
is non-zero, i.e., the function is potentially blocking, the call | is non-zero, i.e., the function is potentially blocking, the call | ||||
is a cancellation point. | is a cancellation point. | ||||
Otherwise, i.e., if | Otherwise, i.e., if | ||||
.Fa nevents | .Fa nevents | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |