Submit #2860 ยป 0001-Bring-in-EV_RECEIPT-revision-197243-and-EV_DISPATCH-.patch
lib/libc/sys/kqueue.2 | ||
---|---|---|
.Fn kevent
|
||
will not return it.
|
||
The filter itself is not disabled.
|
||
.It EV_DISPATCH
|
||
Disable the event source immediately after delivery of an event.
|
||
See
|
||
.Dv EV_DISABLE
|
||
above.
|
||
.It Dv EV_DELETE
|
||
Removes the event from the kqueue.
|
||
Events which are attached to file descriptors are automatically
|
||
deleted on the last close of the descriptor.
|
||
.It EV_RECEIPT
|
||
This flag is useful for making bulk changes to a kqueue without draining
|
||
any pending events.
|
||
When passed as input, it forces
|
||
.Dv EV_ERROR
|
||
to always be returned.
|
||
When a filter is successfully added the
|
||
.Va data
|
||
field will be zero.
|
||
.It Dv EV_ONESHOT
|
||
Causes the event to return only the first occurrence of the filter
|
||
being triggered.
|
sys/kern/kern_event.c | ||
---|---|---|
* to post the error (see sys_poll()), then we
|
||
* ignore it too.
|
||
*/
|
||
if (error) {
|
||
if (error || (kevp->flags & EV_RECEIPT)) {
|
||
kevp->flags = EV_ERROR;
|
||
kevp->data = error;
|
||
lres = *res;
|
||
... | ... | |
kn->kn_status &= ~KN_QUEUED;
|
||
kn->kn_status |= KN_DELETING | KN_REPROCESS;
|
||
} else {
|
||
if (kn->kn_flags & EV_CLEAR) {
|
||
kn->kn_data = 0;
|
||
kn->kn_fflags = 0;
|
||
if (kn->kn_flags & (EV_CLEAR | EV_DISPATCH)) {
|
||
if (kn->kn_flags & EV_CLEAR) {
|
||
kn->kn_data = 0;
|
||
kn->kn_fflags = 0;
|
||
}
|
||
if (kn->kn_flags & EV_DISPATCH) {
|
||
kn->kn_status |= KN_DISABLED;
|
||
}
|
||
kn->kn_status &= ~(KN_QUEUED |
|
||
KN_ACTIVE);
|
||
} else {
|
sys/sys/event.h | ||
---|---|---|
/* flags */
|
||
#define EV_ONESHOT 0x0010 /* only report one occurrence */
|
||
#define EV_CLEAR 0x0020 /* clear event state after reporting */
|
||
#define EV_RECEIPT 0x0040 /* force EV_ERROR on success, data=0 */
|
||
#define EV_DISPATCH 0x0080 /* disable event after reporting */
|
||
#define EV_SYSFLAGS 0xF000 /* reserved by system */
|
||
#define EV_FLAG1 0x2000 /* filter-specific flag */
|