summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-10-20 03:08:16 +0000
committerthorpej <thorpej@NetBSD.org>2021-10-20 03:08:16 +0000
commit8abbca48b237c9edc3ffb387e9074ddcff8b645d (patch)
tree41861906d64ee2ea60ac288b69c2b14012886108 /lib/libc/sys
parent6ddcd84a3618d73c6acd9eb1ba9c92a563467245 (diff)
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example). In support of the above: - Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs. NetBSD 9.99.92.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/kqueue.222
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index 5288d75540b..b44e0e8574a 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -1,4 +1,4 @@
-.\" $NetBSD: kqueue.2,v 1.54 2021/10/13 04:57:19 thorpej Exp $
+.\" $NetBSD: kqueue.2,v 1.55 2021/10/20 03:08: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 11, 2021
+.Dd October 15, 2021
.Dt KQUEUE 2
.Os
.Sh NAME
@@ -440,24 +440,32 @@ Takes a file descriptor as the identifier and the events to watch for in
.Va fflags ,
and returns when one or more of the requested events occurs on the descriptor.
The events to monitor are:
-.Bl -tag -width XXNOTE_RENAME
+.Bl -tag -width NOTE_CLOSE_WRITE
+.It Dv NOTE_ATTRIB
+The file referenced by the descriptor had its attributes changed.
+.It Dv NOTE_CLOSE
+A file descriptor without write access referencing the file was closed.
+.It Dv NOTE_CLOSE_WRITE
+A file descriptor with write access referencing the file was closed.
.It Dv NOTE_DELETE
.Xr unlink 2
was called on the file referenced by the descriptor.
-.It Dv NOTE_WRITE
-A write occurred on the file referenced by the descriptor.
.It Dv NOTE_EXTEND
The file referenced by the descriptor was extended.
-.It Dv NOTE_ATTRIB
-The file referenced by the descriptor had its attributes changed.
.It Dv NOTE_LINK
The link count on the file changed.
+.It Dv NOTE_OPEN
+The file refrenced by the descriptor was opened.
+.It Dv NOTE_READ
+A read occurred on the file referenced by the descriptor.
.It Dv NOTE_RENAME
The file referenced by the descriptor was renamed.
.It Dv NOTE_REVOKE
Access to the file was revoked via
.Xr revoke 2
or the underlying file system was unmounted.
+.It Dv NOTE_WRITE
+A write occurred on the file referenced by the descriptor.
.El
.Pp
On return,