git: 0a42a5c783be - main - kevent(2): add kern_kevent_generic

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 09 Nov 2026 11:08:07 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a42a5c783beebdaee8fad0142c969a6c64e8b57

commit 0a42a5c783beebdaee8fad0142c969a6c64e8b57
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-09 11:07:57 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-09 11:07:57 +0000

    kevent(2): add kern_kevent_generic
    
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
---
 sys/kern/kern_event.c | 15 +--------------
 sys/sys/syscallsubr.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 92f7833db282..e90397eb2c96 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -123,10 +123,6 @@ static int	kqueue_scan(struct kqueue *kq, int maxevents,
 static void 	kqueue_wakeup(struct kqueue *kq);
 static const struct filterops *kqueue_fo_find(int filt);
 static void	kqueue_fo_release(int filt);
-struct g_kevent_args;
-static int	kern_kevent_generic(struct thread *td,
-		    struct g_kevent_args *uap,
-		    struct kevent_copyops *k_ops, const char *struct_name);
 
 static fo_ioctl_t	kqueue_ioctl;
 static fo_poll_t	kqueue_poll;
@@ -1291,15 +1287,6 @@ kern_kqueue(struct thread *td, int flags, bool cponfork, struct filecaps *fcaps)
 	return (0);
 }
 
-struct g_kevent_args {
-	int	fd;
-	const void *changelist;
-	int	nchanges;
-	void	*eventlist;
-	int	nevents;
-	const struct timespec *timeout;
-};
-
 int
 sys_kevent(struct thread *td, struct kevent_args *uap)
 {
@@ -1321,7 +1308,7 @@ sys_kevent(struct thread *td, struct kevent_args *uap)
 	return (kern_kevent_generic(td, &gk_args, &k_ops, "kevent"));
 }
 
-static int
+int
 kern_kevent_generic(struct thread *td, struct g_kevent_args *uap,
     struct kevent_copyops *k_ops, const char *struct_name)
 {
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 1fb47633be11..872191c6b3d3 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -70,6 +70,15 @@ struct uio;
 struct vm_map;
 struct vmspace;
 
+struct g_kevent_args {
+	int	fd;
+	const void *changelist;
+	int	nchanges;
+	void	*eventlist;
+	int	nevents;
+	const struct timespec *timeout;
+};
+
 typedef int (*mmap_check_fp_fn)(struct file *, int, int, int);
 
 struct mmap_req {
@@ -256,6 +265,8 @@ int	kern_kenv(struct thread *td, int what, const char *namep, char *val,
 	    int vallen);
 int	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
 	    struct kevent_copyops *k_ops, const struct timespec *timeout);
+int	kern_kevent_generic(struct thread *td, struct g_kevent_args *uap,
+	    struct kevent_copyops *k_ops, const char *struct_name);
 int	kern_kevent_anonymous(struct thread *td, int nevents,
 	    struct kevent_copyops *k_ops);
 int	kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,