diff options
author | mpi <mpi@openbsd.org> | 2020-11-25 13:49:00 +0000 |
---|---|---|
committer | mpi <mpi@openbsd.org> | 2020-11-25 13:49:00 +0000 |
commit | a270f5686543ffdd3e619308c4f4bfe105b5c83a (patch) | |
tree | ae77db3e483a667501391057248ce38a68f3781c /sys/sys/event.h | |
parent | When processing proposed static routes (inc. default route) ignore (diff) | |
download | wireguard-openbsd-a270f5686543ffdd3e619308c4f4bfe105b5c83a.tar.xz wireguard-openbsd-a270f5686543ffdd3e619308c4f4bfe105b5c83a.zip |
Change kqueue_scan() to keep track of collected events in the given context.
It is now possible to call the function multiple times to collect events.
For that, the end marker has to be preserved between calls because otherwise
the scan might collect an event more than once. If a collected event gets
reactivated during scanning, it will be added at the tail of the queue,
out of reach because of the end marker.
This is required to implement select(2) and poll(2) on top of kqueue_scan().
Done & originally committed by visa@ in r1.143, in snap for more than 2 weeks.
ok visa@, anton@
Diffstat (limited to 'sys/sys/event.h')
-rw-r--r-- | sys/sys/event.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h index a9ecbe6cf78..0c7b8f6f7f9 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.46 2020/10/11 07:11:59 mpi Exp $ */ +/* $OpenBSD: event.h,v 1.47 2020/11/25 13:49:00 mpi Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -204,6 +204,9 @@ struct kqueue_scan_state { struct kqueue *kqs_kq; /* kqueue of this scan */ struct knote kqs_start; /* start marker */ struct knote kqs_end; /* end marker */ + int kqs_nevent; /* number of events collected */ + int kqs_queued; /* if set, end marker is + * in queue */ }; struct proc; |