summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-10-13 04:57:19 +0000
committerthorpej <thorpej@NetBSD.org>2021-10-13 04:57:19 +0000
commitd288317ac8dab1eed547cea0b2e7295c03b27bf4 (patch)
treeed260f6768cc7dbf967ad6689f7d6a57ea49dd50 /lib/libc/sys
parent5aae2f7d9d0d43edbd238bdf38ac3e37e5553a85 (diff)
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS,
NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/kqueue.281
1 files changed, 76 insertions, 5 deletions
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index 219ae405d26..5288d75540b 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -1,4 +1,4 @@
-.\" $NetBSD: kqueue.2,v 1.53 2020/10/31 14:35:28 christos Exp $
+.\" $NetBSD: kqueue.2,v 1.54 2021/10/13 04:57:19 thorpej Exp $
.\"
.\" Copyright (c) 2000 Jonathan Lemon
.\" All rights reserved.
@@ -32,7 +32,7 @@
.\"
.\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.22 2001/06/27 19:55:57 dd Exp $
.\"
-.Dd October 30, 2020
+.Dd October 11, 2021
.Dt KQUEUE 2
.Os
.Sh NAME
@@ -521,13 +521,72 @@ Establishes an arbitrary timer identified by
.Va ident .
When adding a timer,
.Va data
-specifies the timeout period in milliseconds.
-The timer will be periodic unless EV_ONESHOT is specified.
+specifies the timeout period in units described below, or, if
+.Dv NOTE_ABSTIME
+is set in
+.Va fflags ,
+specifies the absolute time at which the timer should fire.
+The timer will repeat unless
+.Dv EV_ONESHOT
+is set in
+.Va flags
+or
+.Dv NOTE_ABSTIME
+is set in
+.Va fflags .
On return,
.Va data
contains the number of times the timeout has expired since the last call to
.Fn kevent .
-This filter automatically sets the EV_CLEAR flag internally.
+This filter automatically sets
+.Dv EV_CLEAR
+in
+.va flags
+for periodic timers.
+Timers created with
+.Dv NOTE_ABSTIME
+remain activated on the kqueue once the absolute time has passed unless
+.Dv EV_CLEAR
+or
+.Dv EV_ONESHOT
+are also specified.
+.Dv CLOCK_REALTIME
+is the reference clock for timers created with
+.Dv NOTE_ABSTIME.
+.Pp
+The filter accepts the following flags in the
+.Va fflags
+argument:
+.Bl -tag -width XXNOTE_TRACKERR
+.It Dv NOTE_SECONDS
+The timer value in
+.Va data
+is expressed in seconds.
+.It Dv NOTE_MSECONDS
+The timer value in
+.Va data
+is expressed in milliseconds.
+.It Dv NOTE_USECONDS
+The timer value in
+.Va data
+is expressed in microseconds.
+.It Dv NOTE_NSECONDS
+The timer value in
+.Va data
+is expressed in nanoseconds.
+.It Dv NOTE_ABSTIME
+The timer value is an absolute time; see discussion above.
+.El
+.Pp
+Note that
+.Dv NOTE_SECONDS ,
+.Dv NOTE_MSECONDS ,
+.Dv NOTE_USECONDS ,
+and
+.Dv NOTE_NSECONDS
+are mutually exclusive; behavior is undefined if more than one are specified.
+If a timer value unit is not specified, the default is
+.Dv NOTE_MSECONDS .
.It Dv EVFILT_FS
Establishes a file system monitor.
Currently it only monitors file system mount and unmount actions.
@@ -781,3 +840,15 @@ The
.Va udata
type was changed from intptr_t to void * in
.Nx 10.0 .
+.Pp
+Support for
+.Dv NOTE_SECONDS ,
+.Dv NOTE_MSECONDS ,
+.Dv NOTE_USECONDS ,
+.Dv NOTE_NSECONDS ,
+and
+.Dv NOTE_ABSTIME
+filter flags for
+.Dv EVFILT_TIMER
+was added in
+.Nx 10.0 .