diff options
author | visa <visa@openbsd.org> | 2021-01-17 05:56:32 +0000 |
---|---|---|
committer | visa <visa@openbsd.org> | 2021-01-17 05:56:32 +0000 |
commit | 60229baafff967d7f0bfc82311ade75e6393193f (patch) | |
tree | f8746ab09bc03efd4bd98e896a675edbadcc68f0 /sys/sys/event.h | |
parent | Replace SB_KNOTE and sb_flagsintr with direct checking of klist. (diff) | |
download | wireguard-openbsd-60229baafff967d7f0bfc82311ade75e6393193f.tar.xz wireguard-openbsd-60229baafff967d7f0bfc82311ade75e6393193f.zip |
kqueue: Revise fd close notification
Deliver file descriptor close notification for __EV_POLL knotes through
struct kevent that kqueue_scan() returns. This replaces the previous way
of returning EBADF from kqueue_scan(), making it easier to determine
what exactly has changed.
When a file descriptor is closed, its __EV_POLL knotes are turned into
one-shot events and queued for delivery. These knotes are "unregistered"
as they are reachable only through the queue of active events. This
reduces interference with the normal workings of kqueue. However, more
care is needed to avoid leaking knotes. In addition, the unregistering
removes a limit on the number of issued knotes. To prevent accumulation
of pending fd close notifications, kqpoll_init() flushes the active
queue at the start of a kqpoll scan.
OK mpi@
Diffstat (limited to 'sys/sys/event.h')
-rw-r--r-- | sys/sys/event.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h index 1ab010b9a21..b01bfde3780 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.52 2020/12/25 12:59:53 visa Exp $ */ +/* $OpenBSD: event.h,v 1.53 2021/01/17 05:56:32 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -195,6 +195,8 @@ struct knote { #define KN_DETACHED 0x0008 /* knote is detached */ #define KN_PROCESSING 0x0010 /* knote is being processed */ #define KN_WAITING 0x0020 /* waiting on processing */ +#define KN_ATTACHED 0x0040 /* knote is attached to + * a knlist of the kqueue */ #define kn_id kn_kevent.ident #define kn_filter kn_kevent.filter |