From c78098b6fd34d7b1be708a9f83a40e9ecabe3690 Mon Sep 17 00:00:00 2001 From: visa Date: Fri, 10 Feb 2023 14:34:16 +0000 Subject: [PATCH] Adjust knote(9) API Make knote(9) lock the knote list internally, and add knote_locked(9) for the typical situation where the list is already locked. Remove the KNOTE(9) macro to simplify the API. Manual page OK jmc@ OK mpi@ mvs@ --- share/man/man9/knote.9 | 33 ++++++++++++++----------- sys/arch/arm64/dev/apm.c | 4 +-- sys/arch/i386/i386/apm.c | 4 +-- sys/arch/loongson/dev/apm.c | 4 +-- sys/dev/acpi/acpi.c | 4 +-- sys/dev/audio.c | 6 ++--- sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c | 2 +- sys/dev/pci/drm/drm_connector.c | 2 +- sys/dev/pci/drm/drm_linux.c | 6 ++--- sys/dev/pci/drm/drm_mode_object.c | 2 +- sys/dev/pci/drm/i915/i915_driver.c | 2 +- sys/kern/kern_event.c | 18 ++++++++++---- sys/kern/kern_exec.c | 4 +-- sys/kern/kern_fork.c | 4 +-- sys/kern/kern_sig.c | 4 +-- sys/kern/sys_generic.c | 4 +-- sys/kern/sys_pipe.c | 4 +-- sys/kern/uipc_socket.c | 4 +-- sys/kern/uipc_socket2.c | 4 +-- sys/kern/uipc_syscalls.c | 4 +-- sys/net/bpf.c | 4 +-- sys/net/if_pppx.c | 10 +++----- sys/sys/event.h | 9 ++----- sys/sys/vnode.h | 4 +-- 24 files changed, 74 insertions(+), 72 deletions(-) diff --git a/share/man/man9/knote.9 b/share/man/man9/knote.9 index d9b4b016c0f..81b663108fe 100644 --- a/share/man/man9/knote.9 +++ b/share/man/man9/knote.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: knote.9,v 1.9 2014/01/21 03:15:46 schwarze Exp $ +.\" $OpenBSD: knote.9,v 1.10 2023/02/10 14:34:16 visa Exp $ .\" $NetBSD: knote.9,v 1.9 2003/04/16 13:35:29 wiz Exp $ .\" .\" Copyright (c) 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -28,23 +28,26 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: January 21 2014 $ +.Dd $Mdocdate: February 10 2023 $ .Dt KNOTE 9 .Os .Sh NAME .Nm knote , -.Nm KNOTE +.Nm knote_locked .Nd raise kernel event .Sh SYNOPSIS .In sys/param.h .In sys/event.h .Ft void .Fn knote "struct klist *list" "long hint" -.Fn KNOTE "struct klist *list" "long hint" +.Ft void +.Fn knote_locked "struct klist *list" "long hint" .Sh DESCRIPTION The .Fn knote -function provides a hook into the kqueue kernel event notification +and +.Fn knote_locked +functions provide a hook into the kqueue kernel event notification mechanism to allow sections of the kernel to raise a kernel event in the form of a .Sq knote , @@ -60,7 +63,7 @@ of knotes, along with a .Fa hint (which is passed to the appropriate filter routine). .Fn knote -then walks the +then locks and walks the .Fa list making calls to the filter routine for each knote. As each knote contains a reference to the data structure that it is @@ -80,17 +83,19 @@ If the knote is already on the active list, no action is taken, but the call to the filter occurs in order to provide an opportunity for the filter to record the activity. .Pp +.Fn knote_locked +is like +.Fn knote +but assumes that the +.Fa list +is already locked. +.Pp .Fn knote +and +.Fn knote_locked must not be called from interrupt contexts running at an interrupt priority level higher than .Fn splsched . -.Pp -.Fn KNOTE -is a macro that calls -.Fn knote list hint -if -.Fa list -is not empty. .\" .Sh ERRORS .Sh SEE ALSO .Xr kqueue 2 @@ -98,8 +103,6 @@ is not empty. .Sh HISTORY The .Fn knote -and -.Fn KNOTE functions first appeared in .Fx 4.1 , and then in diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index 80b0d77f967..13529eb4566 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.21 2023/01/22 13:14:21 kettenis Exp $ */ +/* $OpenBSD: apm.c,v 1.22 2023/02/10 14:34:16 visa Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -345,7 +345,7 @@ apm_record_event(u_int event) return 1; apm_evindex++; - KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(event, apm_evindex)); + knote_locked(&sc->sc_note, APM_EVENT_COMPOSE(event, apm_evindex)); return 0; } diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c index 7cd1f27440c..f4b891c0c3f 100644 --- a/sys/arch/i386/i386/apm.c +++ b/sys/arch/i386/i386/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.129 2023/01/30 10:49:04 jsg Exp $ */ +/* $OpenBSD: apm.c,v 1.130 2023/02/10 14:34:16 visa Exp $ */ /*- * Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved. @@ -311,7 +311,7 @@ apm_record_event(struct apm_softc *sc, u_int type) } apm_evindex++; - KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(type, apm_evindex)); + knote_locked(&sc->sc_note, APM_EVENT_COMPOSE(type, apm_evindex)); return (0); } diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c index 859c692f2d6..984c2aeb75b 100644 --- a/sys/arch/loongson/dev/apm.c +++ b/sys/arch/loongson/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.41 2022/11/19 16:23:48 cheloha Exp $ */ +/* $OpenBSD: apm.c,v 1.42 2023/02/10 14:34:16 visa Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -363,7 +363,7 @@ apm_record_event(u_int event, const char *src, const char *msg) return (1); apm_evindex++; - KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(event, apm_evindex)); + knote_locked(&sc->sc_note, APM_EVENT_COMPOSE(event, apm_evindex)); return (0); } diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index fc3c1d160ee..853bad1ab43 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.418 2022/09/13 17:14:54 kettenis Exp $ */ +/* $OpenBSD: acpi.c,v 1.419 2023/02/10 14:34:16 visa Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -3483,7 +3483,7 @@ acpi_record_event(struct acpi_softc *sc, u_int type) return (1); acpi_evindex++; - KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(type, acpi_evindex)); + knote_locked(&sc->sc_note, APM_EVENT_COMPOSE(type, acpi_evindex)); return (0); } diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 5a388e4608c..3c3f3cf9e6b 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.205 2022/11/08 17:53:01 kn Exp $ */ +/* $OpenBSD: audio.c,v 1.206 2023/02/10 14:34:16 visa Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov * @@ -285,7 +285,7 @@ audio_mixer_wakeup(struct audio_softc *sc) wakeup(&sc->mix_blocking); sc->mix_blocking = 0; } - KNOTE(&sc->mix_klist, 0); + knote_locked(&sc->mix_klist, 0); } void @@ -297,7 +297,7 @@ audio_buf_wakeup(struct audio_buf *buf) wakeup(&buf->blocking); buf->blocking = 0; } - KNOTE(&buf->klist, 0); + knote_locked(&buf->klist, 0); } int diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c index b024bf7d12b..b3c1f4a0a82 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c @@ -3324,7 +3324,7 @@ amdgpu_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) case WSDISPLAYIO_PARAM_BRIGHTNESS: bd->props.brightness = dp->curval; backlight_update_status(bd); - KNOTE(&adev->ddev.note, NOTE_CHANGE); + knote_locked(&adev->ddev.note, NOTE_CHANGE); return 0; } break; diff --git a/sys/dev/pci/drm/drm_connector.c b/sys/dev/pci/drm/drm_connector.c index 7b75d6ab23b..6489e8c2900 100644 --- a/sys/dev/pci/drm/drm_connector.c +++ b/sys/dev/pci/drm/drm_connector.c @@ -2590,7 +2590,7 @@ int drm_connector_set_obj_prop(struct drm_mode_object *obj, } else if (property == connector->backlight_property) { connector->backlight_device->props.brightness = value; backlight_schedule_update_status(connector->backlight_device); - KNOTE(&connector->dev->note, NOTE_CHANGE); + knote_locked(&connector->dev->note, NOTE_CHANGE); ret = 0; #endif } else if (connector->funcs->set_property) diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index d9b716bb485..a5c6aff98f5 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.95 2023/01/01 01:34:34 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.96 2023/02/10 14:34:16 visa Exp $ */ /* * Copyright (c) 2013 Jonathan Gray * Copyright (c) 2015, 2016 Mark Kettenis @@ -1541,13 +1541,13 @@ backlight_disable(struct backlight_device *bd) void drm_sysfs_hotplug_event(struct drm_device *dev) { - KNOTE(&dev->note, NOTE_CHANGE); + knote_locked(&dev->note, NOTE_CHANGE); } void drm_sysfs_connector_hotplug_event(struct drm_connector *connector) { - KNOTE(&connector->dev->note, NOTE_CHANGE); + knote_locked(&connector->dev->note, NOTE_CHANGE); } void diff --git a/sys/dev/pci/drm/drm_mode_object.c b/sys/dev/pci/drm/drm_mode_object.c index 6033255a906..8f4dbec4c56 100644 --- a/sys/dev/pci/drm/drm_mode_object.c +++ b/sys/dev/pci/drm/drm_mode_object.c @@ -561,7 +561,7 @@ retry: struct drm_connector *connector = obj_to_connector(obj); connector->backlight_device->props.brightness = prop_value; backlight_schedule_update_status(connector->backlight_device); - KNOTE(&connector->dev->note, NOTE_CHANGE); + knote_locked(&connector->dev->note, NOTE_CHANGE); ret = 0; #endif } else { diff --git a/sys/dev/pci/drm/i915/i915_driver.c b/sys/dev/pci/drm/i915/i915_driver.c index 0b387e2a41c..05d373cc8a8 100644 --- a/sys/dev/pci/drm/i915/i915_driver.c +++ b/sys/dev/pci/drm/i915/i915_driver.c @@ -2251,7 +2251,7 @@ inteldrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) case WSDISPLAYIO_PARAM_BRIGHTNESS: bd->props.brightness = dp->curval; backlight_update_status(bd); - KNOTE(&dev_priv->drm.note, NOTE_CHANGE); + knote_locked(&dev_priv->drm.note, NOTE_CHANGE); return 0; } break; diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 388691ee69d..a31c036a8a5 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.194 2022/11/09 22:25:36 claudio Exp $ */ +/* $OpenBSD: kern_event.c,v 1.195 2023/02/10 14:34:17 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -1590,9 +1590,7 @@ kqueue_task(void *arg) { struct kqueue *kq = arg; - mtx_enter(&kqueue_klist_lock); - KNOTE(&kq->kq_klist, 0); - mtx_leave(&kqueue_klist_lock); + knote(&kq->kq_klist, 0); } void @@ -1743,6 +1741,16 @@ knote_activate(struct knote *kn) */ void knote(struct klist *list, long hint) +{ + int ls; + + ls = klist_lock(list); + knote_locked(list, hint); + klist_unlock(list, ls); +} + +void +knote_locked(struct klist *list, long hint) { struct knote *kn, *kn0; struct kqueue *kq; @@ -1853,7 +1861,7 @@ knote_processexit(struct process *pr) { KERNEL_ASSERT_LOCKED(); - KNOTE(&pr->ps_klist, NOTE_EXIT); + knote_locked(&pr->ps_klist, NOTE_EXIT); /* remove other knotes hanging off the process */ klist_invalidate(&pr->ps_klist); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6a7188c3264..4c30e5a45b9 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.243 2023/01/13 23:02:43 kettenis Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.244 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -675,7 +675,7 @@ sys_execve(struct proc *p, void *v, register_t *retval) /* * notify others that we exec'd */ - KNOTE(&pr->ps_klist, NOTE_EXEC); + knote_locked(&pr->ps_klist, NOTE_EXEC); /* map the process's timekeep page, needs to be before exec_elf_fixup */ if (exec_timekeep_map(pr)) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index ccdd34aafb8..f0f279d9f64 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.245 2023/01/07 05:24:58 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.246 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -465,7 +465,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg, /* * Notify any interested parties about the new process. */ - KNOTE(&curpr->ps_klist, NOTE_FORK | pr->ps_pid); + knote_locked(&curpr->ps_klist, NOTE_FORK | pr->ps_pid); /* * Update stats now that we know the fork was successful. diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 416cef58181..54c86f6dcf4 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.304 2023/01/31 15:18:56 deraadt Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.305 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -985,7 +985,7 @@ ptsignal(struct proc *p, int signum, enum signal_type type) } if (type != SPROPAGATED) - KNOTE(&pr->ps_klist, NOTE_SIGNAL | signum); + knote_locked(&pr->ps_klist, NOTE_SIGNAL | signum); prop = sigprop[signum]; diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 46da93a80c2..29f7363fa94 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.151 2022/12/27 20:13:03 patrick Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.152 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -832,7 +832,7 @@ void selwakeup(struct selinfo *sip) { KERNEL_LOCK(); - KNOTE(&sip->si_note, NOTE_SUBMIT); + knote_locked(&sip->si_note, NOTE_SUBMIT); KERNEL_UNLOCK(); } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 31f3ba45a52..80c401bf6f5 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.143 2022/12/05 23:18:37 deraadt Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.144 2023/02/10 14:34:17 visa Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -370,7 +370,7 @@ pipeselwakeup(struct pipe *cpipe) { rw_assert_wrlock(cpipe->pipe_lock); - KNOTE(&cpipe->pipe_klist, 0); + knote_locked(&cpipe->pipe_klist, 0); if (cpipe->pipe_state & PIPE_ASYNC) pgsigio(&cpipe->pipe_sigio, SIGIO, 0); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 612999623a6..0ca3727ccbd 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.300 2023/02/02 09:35:07 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.301 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -2122,7 +2122,7 @@ void sohasoutofband(struct socket *so) { pgsigio(&so->so_sigio, SIGURG, 0); - KNOTE(&so->so_rcv.sb_klist, 0); + knote_locked(&so->so_rcv.sb_klist, 0); } int diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 80ac5fc7c01..9965baaf91b 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.135 2023/02/02 09:35:07 mvs Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.136 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -545,7 +545,7 @@ sowakeup(struct socket *so, struct sockbuf *sb) } if (sb->sb_flags & SB_ASYNC) pgsigio(&so->so_sigio, SIGIO, 0); - KNOTE(&sb->sb_klist, 0); + knote_locked(&sb->sb_klist, 0); } /* diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 49da6a1bab4..6b8bfc84bac 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.211 2023/01/27 21:01:59 mvs Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.212 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -326,7 +326,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, : (flags & SOCK_NONBLOCK ? FNONBLOCK : 0); /* connection has been removed from the listen queue */ - KNOTE(&head->so_rcv.sb_klist, 0); + knote_locked(&head->so_rcv.sb_klist, 0); if (persocket) sounlock(head); diff --git a/sys/net/bpf.c b/sys/net/bpf.c index cadd105134e..3ac175e459a 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.219 2022/07/09 12:48:21 visa Exp $ */ +/* $OpenBSD: bpf.c,v 1.220 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -586,7 +586,7 @@ bpf_wakeup(struct bpf_d *d) if (d->bd_nreaders) wakeup(d); - KNOTE(&d->bd_klist, 0); + knote_locked(&d->bd_klist, 0); /* * As long as pgsigio() needs to be protected diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index 0d7e8726105..66826738bf3 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.125 2023/01/30 03:31:59 visa Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.126 2023/02/10 14:34:17 visa Exp $ */ /* * Copyright (c) 2010 Claudio Jeker @@ -903,9 +903,7 @@ pppx_if_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, wakeup((caddr_t)pxi->pxi_dev); pxi->pxi_dev->pxd_waiting = 0; } - mtx_enter(&pxi->pxi_dev->pxd_mtx); - KNOTE(&pxi->pxi_dev->pxd_rklist, 0); - mtx_leave(&pxi->pxi_dev->pxd_mtx); + knote(&pxi->pxi_dev->pxd_rklist, 0); } } @@ -1519,8 +1517,6 @@ bad: if (!mq_empty(&sc->sc_mq)) { wakeup(sc); - mtx_enter(&sc->sc_mtx); - KNOTE(&sc->sc_rklist, 0); - mtx_leave(&sc->sc_mtx); + knote(&sc->sc_rklist, 0); } } diff --git a/sys/sys/event.h b/sys/sys/event.h index ec555b2b6df..05139cfe751 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.68 2023/02/02 09:35:07 mvs Exp $ */ +/* $OpenBSD: event.h,v 1.69 2023/02/10 14:34:17 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -152,12 +152,6 @@ struct klist { */ #define NOTE_SUBMIT 0x01000000 /* initial knote submission */ -#define KNOTE(list, hint) do { \ - struct klist *__list = (list); \ - if (!klist_empty(__list)) \ - knote(__list, hint); \ - } while (0) - #define KN_HASHSIZE 64 /* XXX should be tunable */ /* @@ -291,6 +285,7 @@ extern void kqpoll_init(unsigned int); extern void kqpoll_done(unsigned int); extern void kqpoll_exit(void); extern void knote(struct klist *list, long hint); +extern void knote_locked(struct klist *list, long hint); extern void knote_fdclose(struct proc *p, int fd); extern void knote_processexit(struct process *); extern void knote_assign(const struct kevent *, struct knote *); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index c9bb267e78e..30787afddd8 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.167 2022/08/12 14:30:53 visa Exp $ */ +/* $OpenBSD: vnode.h,v 1.168 2023/02/10 14:34:17 visa Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -246,7 +246,7 @@ extern int vttoif_tab[]; #define VATTR_NULL(vap) vattr_null(vap) #define NULLVP ((struct vnode *)NULL) #define VN_KNOTE(vp, b) \ - KNOTE(&vp->v_selectinfo.si_note, (b)) + knote_locked(&vp->v_selectinfo.si_note, (b)) /* * Global vnode data. -- 2.20.1