diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-04-07 13:27:53 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-04-07 13:27:53 +0000 |
commit | 31b8aeb32e081f42e1ec7f34094de4351458aed3 (patch) | |
tree | 620f7a0227efbc1b17d8b8e8b070acdf3c1c0436 | |
parent | a469bdd2f75259dda9613501bb83503033815c3c (diff) |
Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.
OK mpi@, anton@
33 files changed, 161 insertions, 135 deletions
diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index 93d9ae7eb85..336a33fbfcc 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.3 2020/02/20 16:56:51 visa Exp $ */ +/* $OpenBSD: apm.c,v 1.4 2020/04/07 13:27:50 visa Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -271,7 +271,7 @@ filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; - SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_note, kn); } int @@ -303,7 +303,7 @@ apmkqfilter(dev_t dev, struct knote *kn) } kn->kn_hook = (caddr_t)sc; - SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext); + klist_insert(&sc->sc_note, kn); return (0); } diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c index cf62219d414..64f7bbfc7d8 100644 --- a/sys/arch/i386/i386/apm.c +++ b/sys/arch/i386/i386/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.122 2020/02/20 16:56:51 visa Exp $ */ +/* $OpenBSD: apm.c,v 1.123 2020/04/07 13:27:50 visa Exp $ */ /*- * Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved. @@ -1118,7 +1118,7 @@ filt_apmrdetach(struct knote *kn) struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; rw_enter_write(&sc->sc_lock); - SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_note, kn); rw_exit_write(&sc->sc_lock); } @@ -1152,7 +1152,7 @@ apmkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)sc; rw_enter_write(&sc->sc_lock); - SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext); + klist_insert(&sc->sc_note, kn); rw_exit_write(&sc->sc_lock); return (0); } diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c index 4527a1cf0e1..a70a00a6567 100644 --- a/sys/arch/loongson/dev/apm.c +++ b/sys/arch/loongson/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.35 2020/02/20 16:56:51 visa Exp $ */ +/* $OpenBSD: apm.c,v 1.36 2020/04/07 13:27:50 visa Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -292,7 +292,7 @@ filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; - SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_note, kn); } int @@ -324,7 +324,7 @@ apmkqfilter(dev_t dev, struct knote *kn) } kn->kn_hook = (caddr_t)sc; - SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext); + klist_insert(&sc->sc_note, kn); return (0); } diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c index 743dc53fc7b..c99d3a14cdc 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.21 2020/02/20 16:56:51 visa Exp $ */ +/* $OpenBSD: apm.c,v 1.22 2020/04/07 13:27:50 visa Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -305,7 +305,7 @@ filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; - SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_note, kn); } int @@ -337,7 +337,7 @@ apmkqfilter(dev_t dev, struct knote *kn) } kn->kn_hook = (caddr_t)sc; - SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext); + klist_insert(&sc->sc_note, kn); return (0); } diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index a17ca8c6a14..35b990dd7cf 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.379 2020/04/03 08:24:52 mpi Exp $ */ +/* $OpenBSD: acpi.c,v 1.380 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -3476,7 +3476,7 @@ acpi_filtdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(sc->sc_note, kn, knote, kn_selnext); + klist_remove(sc->sc_note, kn); splx(s); } @@ -3510,7 +3510,7 @@ acpikqfilter(dev_t dev, struct knote *kn) kn->kn_hook = sc; s = spltty(); - SLIST_INSERT_HEAD(sc->sc_note, kn, kn_selnext); + klist_insert(sc->sc_note, kn); splx(s); return (0); diff --git a/sys/dev/hotplug.c b/sys/dev/hotplug.c index ac9b589238a..f01bf55d0c4 100644 --- a/sys/dev/hotplug.c +++ b/sys/dev/hotplug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplug.c,v 1.19 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: hotplug.c,v 1.20 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -211,7 +211,7 @@ hotplugkqfilter(dev_t dev, struct knote *kn) } s = splbio(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); } @@ -222,7 +222,7 @@ filt_hotplugrdetach(struct knote *kn) int s; s = splbio(); - SLIST_REMOVE(&hotplug_sel.si_note, kn, knote, kn_selnext); + klist_remove(&hotplug_sel.si_note, kn); splx(s); } diff --git a/sys/dev/midi.c b/sys/dev/midi.c index bea0a601db1..831ab094d45 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.46 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: midi.c,v 1.47 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2003, 2004 Alexandre Ratchov @@ -363,7 +363,7 @@ midikqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (void *)sc; mtx_enter(&audio_lock); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); mtx_leave(&audio_lock); done: device_unref(&sc->dev); @@ -376,7 +376,7 @@ filt_midirdetach(struct knote *kn) struct midi_softc *sc = (struct midi_softc *)kn->kn_hook; mtx_enter(&audio_lock); - SLIST_REMOVE(&sc->rsel.si_note, kn, knote, kn_selnext); + klist_remove(&sc->rsel.si_note, kn); mtx_leave(&audio_lock); } @@ -399,7 +399,7 @@ filt_midiwdetach(struct knote *kn) struct midi_softc *sc = (struct midi_softc *)kn->kn_hook; mtx_enter(&audio_lock); - SLIST_REMOVE(&sc->wsel.si_note, kn, knote, kn_selnext); + klist_remove(&sc->wsel.si_note, kn); mtx_leave(&audio_lock); } diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index d34e7f4bef2..11e72a0d5b6 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.173 2020/03/04 21:19:15 kettenis Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.174 2020/04/07 13:27:51 visa Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org> * Copyright © 2008 Intel Corporation @@ -472,7 +472,7 @@ filt_drmdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(&dev->note, kn, knote, kn_selnext); + klist_remove(&dev->note, kn); splx(s); } @@ -512,7 +512,7 @@ drmkqfilter(dev_t kdev, struct knote *kn) kn->kn_hook = dev; s = spltty(); - SLIST_INSERT_HEAD(&dev->note, kn, kn_selnext); + klist_insert(&dev->note, kn); splx(s); return (0); diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index eb64601111e..a4c92398238 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.104 2020/04/03 08:24:53 mpi Exp $ */ +/* $OpenBSD: ugen.c,v 1.105 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -1298,7 +1298,7 @@ filt_ugenrdetach(struct knote *kn) int s; s = splusb(); - SLIST_REMOVE(&sce->rsel.si_note, kn, knote, kn_selnext); + klist_remove(&sce->rsel.si_note, kn); splx(s); } @@ -1418,7 +1418,7 @@ ugenkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (void *)sce; s = splusb(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index ad441b7cffc..d72d5e150b9 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.78 2020/04/03 08:24:53 mpi Exp $ */ +/* $OpenBSD: uhid.c,v 1.79 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -447,7 +447,7 @@ filt_uhidrdetach(struct knote *kn) int s; s = splusb(); - SLIST_REMOVE(&sc->sc_rsel.si_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_rsel.si_note, kn); splx(s); } @@ -505,7 +505,7 @@ uhidkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (void *)sc; s = splusb(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index 5b8f9994537..59e39cdee42 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.48 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: vscsi.c,v 1.49 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -576,7 +576,7 @@ vscsikqfilter(dev_t dev, struct knote *kn) kn->kn_hook = sc; mtx_enter(&sc->sc_sel_mtx); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); mtx_leave(&sc->sc_sel_mtx); /* device ref is given to the knote in the klist */ @@ -591,7 +591,7 @@ filt_vscsidetach(struct knote *kn) struct klist *klist = &sc->sc_sel.si_note; mtx_enter(&sc->sc_sel_mtx); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); mtx_leave(&sc->sc_sel_mtx); device_unref(&sc->sc_dev); diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index 36a8dd9eaa0..4547017a3d1 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsevent.c,v 1.23 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: wsevent.c,v 1.24 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */ /* @@ -236,7 +236,7 @@ wsevent_kqfilter(struct wseventvar *ev, struct knote *kn) kn->kn_hook = ev; s = splwsevent(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); @@ -250,7 +250,7 @@ filt_wseventdetach(struct knote *kn) int s; s = splwsevent(); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); splx(s); } diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 26214b90a24..f1d43c64bd0 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.82 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.83 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -1002,7 +1002,7 @@ cd9660_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); return (0); } @@ -1012,7 +1012,7 @@ filt_cd9660detach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); } int diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 5eae8dc9095..3613f30fad0 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.130 2020/04/07 12:52:27 visa Exp $ */ +/* $OpenBSD: kern_event.c,v 1.131 2020/04/07 13:27:51 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -181,7 +181,8 @@ KQRELE(struct kqueue *kq) fdpunlock(fdp); } - free(kq->kq_knlist, M_KEVENT, kq->kq_knlistsize * sizeof(struct klist)); + free(kq->kq_knlist, M_KEVENT, kq->kq_knlistsize * + sizeof(struct knlist)); hashfree(kq->kq_knhash, KN_HASHSIZE, M_KEVENT); pool_put(&kqueue_pool, kq); } @@ -212,7 +213,7 @@ kqueue_kqfilter(struct file *fp, struct knote *kn) return (EINVAL); kn->kn_fop = &kqread_filtops; - SLIST_INSERT_HEAD(&kq->kq_sel.si_note, kn, kn_selnext); + klist_insert(&kq->kq_sel.si_note, kn); return (0); } @@ -221,7 +222,7 @@ filt_kqdetach(struct knote *kn) { struct kqueue *kq = kn->kn_fp->f_data; - SLIST_REMOVE(&kq->kq_sel.si_note, kn, knote, kn_selnext); + klist_remove(&kq->kq_sel.si_note, kn); } int @@ -266,7 +267,7 @@ filt_procattach(struct knote *kn) } /* XXX lock the proc here while adding to the list? */ - SLIST_INSERT_HEAD(&pr->ps_klist, kn, kn_selnext); + klist_insert(&pr->ps_klist, kn); return (0); } @@ -288,7 +289,7 @@ filt_procdetach(struct knote *kn) return; /* XXX locking? this might modify another process. */ - SLIST_REMOVE(&pr->ps_klist, kn, knote, kn_selnext); + klist_remove(&pr->ps_klist, kn); } int @@ -320,7 +321,7 @@ filt_proc(struct knote *kn, long hint) splx(s); kn->kn_flags |= (EV_EOF | EV_ONESHOT); kn->kn_data = W_EXITCODE(pr->ps_xexit, pr->ps_xsig); - SLIST_REMOVE(&pr->ps_klist, kn, knote, kn_selnext); + klist_remove(&pr->ps_klist, kn); return (1); } @@ -671,7 +672,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p) const struct filterops *fops = NULL; struct file *fp = NULL; struct knote *kn = NULL, *newkn = NULL; - struct klist *list = NULL; + struct knlist *list = NULL; int s, error = 0; if (kev->filter < 0) { @@ -1087,7 +1088,7 @@ kqueue_close(struct file *fp, struct proc *p) kq->kq_state |= KQ_DYING; kqueue_wakeup(kq); - KASSERT(SLIST_EMPTY(&kq->kq_sel.si_note)); + KASSERT(klist_empty(&kq->kq_sel.si_note)); task_del(systq, &kq->kq_task); KQRELE(kq); @@ -1119,7 +1120,7 @@ kqueue_wakeup(struct kqueue *kq) kq->kq_state &= ~KQ_SLEEP; wakeup(kq); } - if ((kq->kq_state & KQ_SEL) || !SLIST_EMPTY(&kq->kq_sel.si_note)) { + if ((kq->kq_state & KQ_SEL) || !klist_empty(&kq->kq_sel.si_note)) { /* Defer activation to avoid recursion. */ KQREF(kq); if (!task_add(systq, &kq->kq_task)) @@ -1130,7 +1131,7 @@ kqueue_wakeup(struct kqueue *kq) static void kqueue_expand_hash(struct kqueue *kq) { - struct klist *hash; + struct knlist *hash; u_long hashmask; if (kq->kq_knhashmask == 0) { @@ -1148,7 +1149,7 @@ kqueue_expand_hash(struct kqueue *kq) static void kqueue_expand_list(struct kqueue *kq, int fd) { - struct klist *list; + struct knlist *list; int size; if (kq->kq_knlistsize <= fd) { @@ -1236,16 +1237,16 @@ knote(struct klist *list, long hint) { struct knote *kn, *kn0; - SLIST_FOREACH_SAFE(kn, list, kn_selnext, kn0) + SLIST_FOREACH_SAFE(kn, &list->kl_list, kn_selnext, kn0) if (kn->kn_fop->f_event(kn, hint)) knote_activate(kn); } /* - * remove all knotes from a specified klist + * remove all knotes from a specified knlist */ void -knote_remove(struct proc *p, struct klist *list) +knote_remove(struct proc *p, struct knlist *list) { struct knote *kn; int s; @@ -1270,7 +1271,7 @@ knote_fdclose(struct proc *p, int fd) { struct filedesc *fdp = p->p_p->ps_fd; struct kqueue *kq; - struct klist *list; + struct knlist *list; /* * fdplock can be ignored if the file descriptor table is being freed @@ -1305,14 +1306,14 @@ knote_processexit(struct proc *p) KNOTE(&pr->ps_klist, NOTE_EXIT); /* remove other knotes hanging off the process */ - knote_remove(p, &pr->ps_klist); + knote_remove(p, &pr->ps_klist.kl_list); } void knote_attach(struct knote *kn) { struct kqueue *kq = kn->kn_kq; - struct klist *list; + struct knlist *list; if (kn->kn_fop->f_flags & FILTEROP_ISFD) { KASSERT(kq->kq_knlistsize > kn->kn_id); @@ -1332,7 +1333,7 @@ void knote_drop(struct knote *kn, struct proc *p) { struct kqueue *kq = kn->kn_kq; - struct klist *list; + struct knlist *list; int s; KASSERT(kn->kn_filter != EVFILT_MARKER); @@ -1391,6 +1392,24 @@ knote_dequeue(struct knote *kn) } void +klist_insert(struct klist *klist, struct knote *kn) +{ + SLIST_INSERT_HEAD(&klist->kl_list, kn, kn_selnext); +} + +void +klist_remove(struct klist *klist, struct knote *kn) +{ + SLIST_REMOVE(&klist->kl_list, kn, knote, kn_selnext); +} + +int +klist_empty(struct klist *klist) +{ + return (SLIST_EMPTY(&klist->kl_list)); +} + +void klist_invalidate(struct klist *list) { struct knote *kn; @@ -1403,7 +1422,7 @@ klist_invalidate(struct klist *list) NET_ASSERT_UNLOCKED(); s = splhigh(); - while ((kn = SLIST_FIRST(list)) != NULL) { + while ((kn = SLIST_FIRST(&list->kl_list)) != NULL) { if (!knote_acquire(kn)) continue; splx(s); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 97592e86395..ba9f425a705 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.255 2020/03/20 08:14:07 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.256 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1811,7 +1811,7 @@ filt_sigattach(struct knote *kn) kn->kn_flags |= EV_CLEAR; /* automatically set */ /* XXX lock the proc here while adding to the list? */ - SLIST_INSERT_HEAD(&pr->ps_klist, kn, kn_selnext); + klist_insert(&pr->ps_klist, kn); return (0); } @@ -1821,7 +1821,7 @@ filt_sigdetach(struct knote *kn) { struct process *pr = kn->kn_ptr.p_process; - SLIST_REMOVE(&pr->ps_klist, kn, knote, kn_selnext); + klist_remove(&pr->ps_klist, kn); } /* diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 129d6c7e109..c25f7a765c4 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.65 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: subr_log.c,v 1.66 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -278,7 +278,7 @@ logkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (void *)msgbufp; s = splhigh(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); @@ -290,7 +290,7 @@ filt_logrdetach(struct knote *kn) int s; s = splhigh(); - SLIST_REMOVE(&logsoftc.sc_selp.si_note, kn, knote, kn_selnext); + klist_remove(&logsoftc.sc_selp.si_note, kn); splx(s); } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 18c32ebd39d..fc221bfd8f1 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.118 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.119 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -908,7 +908,7 @@ pipe_kqfilter(struct file *fp, struct knote *kn) switch (kn->kn_filter) { case EVFILT_READ: kn->kn_fop = &pipe_rfiltops; - SLIST_INSERT_HEAD(&rpipe->pipe_sel.si_note, kn, kn_selnext); + klist_insert(&rpipe->pipe_sel.si_note, kn); break; case EVFILT_WRITE: if (wpipe == NULL) { @@ -917,7 +917,7 @@ pipe_kqfilter(struct file *fp, struct knote *kn) break; } kn->kn_fop = &pipe_wfiltops; - SLIST_INSERT_HEAD(&wpipe->pipe_sel.si_note, kn, kn_selnext); + klist_insert(&wpipe->pipe_sel.si_note, kn); break; default: error = EINVAL; @@ -939,12 +939,12 @@ filt_pipedetach(struct knote *kn) switch (kn->kn_filter) { case EVFILT_READ: - SLIST_REMOVE(&rpipe->pipe_sel.si_note, kn, knote, kn_selnext); + klist_remove(&rpipe->pipe_sel.si_note, kn); break; case EVFILT_WRITE: if (wpipe == NULL) break; - SLIST_REMOVE(&wpipe->pipe_sel.si_note, kn, knote, kn_selnext); + klist_remove(&wpipe->pipe_sel.si_note, kn); break; } diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 0b72a0042db..431b22653de 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.153 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: tty.c,v 1.154 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -1126,7 +1126,7 @@ ttkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = tp; s = spltty(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); @@ -1139,7 +1139,7 @@ filt_ttyrdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(&tp->t_rsel.si_note, kn, knote, kn_selnext); + klist_remove(&tp->t_rsel.si_note, kn); splx(s); } @@ -1166,7 +1166,7 @@ filt_ttywdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(&tp->t_wsel.si_note, kn, knote, kn_selnext); + klist_remove(&tp->t_wsel.si_note, kn); splx(s); } diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index e5b821dfce1..2152bcde86a 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.97 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.98 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -655,7 +655,7 @@ filt_ptcrdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(&pti->pt_selr.si_note, kn, knote, kn_selnext); + klist_remove(&pti->pt_selr.si_note, kn); splx(s); } @@ -691,7 +691,7 @@ filt_ptcwdetach(struct knote *kn) int s; s = spltty(); - SLIST_REMOVE(&pti->pt_selw.si_note, kn, knote, kn_selnext); + klist_remove(&pti->pt_selw.si_note, kn); splx(s); } @@ -753,7 +753,7 @@ ptckqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)pti; s = spltty(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); return (0); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1669cbf9121..17794c199bf 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.242 2020/03/11 22:21:28 sashan Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.243 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -2022,7 +2022,7 @@ soo_kqfilter(struct file *fp, struct knote *kn) return (EINVAL); } - SLIST_INSERT_HEAD(&sb->sb_sel.si_note, kn, kn_selnext); + klist_insert(&sb->sb_sel.si_note, kn); sb->sb_flagsintr |= SB_KNOTE; return (0); @@ -2035,8 +2035,8 @@ filt_sordetach(struct knote *kn) KERNEL_ASSERT_LOCKED(); - SLIST_REMOVE(&so->so_rcv.sb_sel.si_note, kn, knote, kn_selnext); - if (SLIST_EMPTY(&so->so_rcv.sb_sel.si_note)) + klist_remove(&so->so_rcv.sb_sel.si_note, kn); + if (klist_empty(&so->so_rcv.sb_sel.si_note)) so->so_rcv.sb_flagsintr &= ~SB_KNOTE; } @@ -2078,8 +2078,8 @@ filt_sowdetach(struct knote *kn) KERNEL_ASSERT_LOCKED(); - SLIST_REMOVE(&so->so_snd.sb_sel.si_note, kn, knote, kn_selnext); - if (SLIST_EMPTY(&so->so_snd.sb_sel.si_note)) + klist_remove(&so->so_snd.sb_sel.si_note, kn); + if (klist_empty(&so->so_snd.sb_sel.si_note)) so->so_snd.sb_flagsintr &= ~SB_KNOTE; } diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index d696fda9b42..26e01322a1e 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.73 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.74 2020/04/07 13:27:51 visa Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -525,7 +525,7 @@ fifo_kqfilter(void *v) ap->a_kn->kn_hook = so; - SLIST_INSERT_HEAD(&sb->sb_sel.si_note, ap->a_kn, kn_selnext); + klist_insert(&sb->sb_sel.si_note, ap->a_kn); sb->sb_flagsintr |= SB_KNOTE; return (0); @@ -536,8 +536,8 @@ filt_fifordetach(struct knote *kn) { struct socket *so = (struct socket *)kn->kn_hook; - SLIST_REMOVE(&so->so_rcv.sb_sel.si_note, kn, knote, kn_selnext); - if (SLIST_EMPTY(&so->so_rcv.sb_sel.si_note)) + klist_remove(&so->so_rcv.sb_sel.si_note, kn); + if (klist_empty(&so->so_rcv.sb_sel.si_note)) so->so_rcv.sb_flagsintr &= ~SB_KNOTE; } @@ -568,8 +568,8 @@ filt_fifowdetach(struct knote *kn) { struct socket *so = (struct socket *)kn->kn_hook; - SLIST_REMOVE(&so->so_snd.sb_sel.si_note, kn, knote, kn_selnext); - if (SLIST_EMPTY(&so->so_snd.sb_sel.si_note)) + klist_remove(&so->so_snd.sb_sel.si_note, kn); + if (klist_empty(&so->so_snd.sb_sel.si_note)) so->so_snd.sb_flagsintr &= ~SB_KNOTE; } diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index e28d5951878..af0a77f44c2 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.32 2020/04/03 08:08:51 mpi Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.33 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -564,7 +564,7 @@ fusekqfilter(dev_t dev, struct knote *kn) kn->kn_hook = fd; - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); return (0); } @@ -575,7 +575,7 @@ filt_fuse_rdetach(struct knote *kn) struct fuse_d *fd = kn->kn_hook; struct klist *klist = &fd->fd_rsel.si_note; - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); } int diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 881dcb653a7..6438cecd1c9 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.58 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.59 2020/04/07 13:27:51 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -154,7 +154,7 @@ fusefs_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); return (0); } @@ -164,7 +164,7 @@ filt_fusefsdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); } int diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index b0e45969033..fc46268052e 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.131 2020/03/24 14:03:30 krw Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.132 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -1980,7 +1980,7 @@ msdosfs_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); return (0); } @@ -1990,7 +1990,7 @@ filt_msdosfsdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); } int diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 3f8cf6b7933..fd35b5e2b04 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.188 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: bpf.c,v 1.189 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -1190,7 +1190,7 @@ bpfkqfilter(dev_t dev, struct knote *kn) bpf_get(d); kn->kn_hook = d; - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); mtx_enter(&d->bd_mtx); if (d->bd_rtout != -1 && d->bd_rdStart == 0) @@ -1207,7 +1207,7 @@ filt_bpfrdetach(struct knote *kn) KERNEL_ASSERT_LOCKED(); - SLIST_REMOVE(&d->bd_sel.si_note, kn, knote, kn_selnext); + klist_remove(&d->bd_sel.si_note, kn); bpf_put(d); } diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index 85dcbd7d11b..1a35fce70bc 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.81 2020/04/07 07:11:22 claudio Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.82 2020/04/07 13:27:52 visa Exp $ */ /* * Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org> @@ -537,7 +537,7 @@ pppxkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)pxd; mtx_enter(mtx); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); mtx_leave(mtx); return (0); @@ -550,7 +550,7 @@ filt_pppx_rdetach(struct knote *kn) struct klist *klist = &pxd->pxd_rsel.si_note; mtx_enter(&pxd->pxd_rsel_mtx); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); mtx_leave(&pxd->pxd_rsel_mtx); } @@ -571,7 +571,7 @@ filt_pppx_wdetach(struct knote *kn) struct klist *klist = &pxd->pxd_wsel.si_note; mtx_enter(&pxd->pxd_wsel_mtx); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); mtx_leave(&pxd->pxd_wsel_mtx); } @@ -1496,7 +1496,7 @@ pppackqfilter(dev_t dev, struct knote *kn) kn->kn_hook = sc; mtx_enter(mtx); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); mtx_leave(mtx); return (0); @@ -1509,7 +1509,7 @@ filt_pppac_rdetach(struct knote *kn) struct klist *klist = &sc->sc_rsel.si_note; mtx_enter(&sc->sc_rsel_mtx); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); mtx_leave(&sc->sc_rsel_mtx); } @@ -1530,7 +1530,7 @@ filt_pppac_wdetach(struct knote *kn) struct klist *klist = &sc->sc_wsel.si_note; mtx_enter(&sc->sc_wsel_mtx); - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); mtx_leave(&sc->sc_wsel_mtx); } diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index b05106c3b89..3b4567bbb19 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.219 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: if_tun.c,v 1.220 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -1001,7 +1001,7 @@ tun_dev_kqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)sc; /* XXX give the sc_ref to the hook? */ s = splhigh(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); splx(s); put: @@ -1016,7 +1016,7 @@ filt_tunrdetach(struct knote *kn) struct tun_softc *sc = kn->kn_hook; s = splhigh(); - SLIST_REMOVE(&sc->sc_rsel.si_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_rsel.si_note, kn); splx(s); } @@ -1038,7 +1038,7 @@ filt_tunwdetach(struct knote *kn) struct tun_softc *sc = kn->kn_hook; s = splhigh(); - SLIST_REMOVE(&sc->sc_wsel.si_note, kn, knote, kn_selnext); + klist_remove(&sc->sc_wsel.si_note, kn); splx(s); } diff --git a/sys/net/switchctl.c b/sys/net/switchctl.c index 3137aaaa186..e315dcd3773 100644 --- a/sys/net/switchctl.c +++ b/sys/net/switchctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchctl.c,v 1.20 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: switchctl.c,v 1.21 2020/04/07 13:27:52 visa Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -409,7 +409,7 @@ switchkqfilter(dev_t dev, struct knote *kn) kn->kn_hook = (caddr_t)sc; - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + klist_insert(klist, kn); return (0); } @@ -420,7 +420,7 @@ filt_switch_rdetach(struct knote *kn) struct switch_softc *sc = (struct switch_softc *)kn->kn_hook; struct klist *klist = &sc->sc_swdev->swdev_rsel.si_note; - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); } int @@ -444,7 +444,7 @@ filt_switch_wdetach(struct knote *kn) struct switch_softc *sc = (struct switch_softc *)kn->kn_hook; struct klist *klist = &sc->sc_swdev->swdev_wsel.si_note; - SLIST_REMOVE(klist, kn, knote, kn_selnext); + klist_remove(klist, kn); } int diff --git a/sys/nfs/nfs_kq.c b/sys/nfs/nfs_kq.c index fcf69f86238..f43211e76c3 100644 --- a/sys/nfs/nfs_kq.c +++ b/sys/nfs/nfs_kq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_kq.c,v 1.29 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: nfs_kq.c,v 1.30 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */ /*- @@ -184,7 +184,7 @@ filt_nfsdetach(struct knote *kn) struct vnode *vp = (struct vnode *)kn->kn_hook; struct kevq *ke; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); /* Remove the vnode from watch list */ rw_enter_write(&nfskevq_lock); @@ -339,7 +339,7 @@ nfs_kqfilter(void *v) /* kick the poller */ wakeup(pnfskq); - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); out: rw_exit_write(&nfskevq_lock); diff --git a/sys/sys/event.h b/sys/sys/event.h index 7d66820a65f..2c345f378d6 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.34 2020/04/04 08:57:36 mpi Exp $ */ +/* $OpenBSD: event.h,v 1.35 2020/04/07 13:27:52 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -121,7 +121,11 @@ struct kevent { */ #include <sys/queue.h> struct knote; -SLIST_HEAD(klist, knote); +SLIST_HEAD(knlist, knote); + +struct klist { + struct knlist kl_list; +}; #ifdef _KERNEL @@ -191,13 +195,16 @@ extern const struct filterops sig_filtops; extern void knote(struct klist *list, long hint); extern void knote_activate(struct knote *); -extern void knote_remove(struct proc *p, struct klist *list); +extern void knote_remove(struct proc *p, struct knlist *list); extern void knote_fdclose(struct proc *p, int fd); extern void knote_processexit(struct proc *); extern int kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p); extern int filt_seltrue(struct knote *kn, long hint); extern int seltrue_kqfilter(dev_t, struct knote *); +extern void klist_insert(struct klist *, struct knote *); +extern void klist_remove(struct klist *, struct knote *); +extern int klist_empty(struct klist *); extern void klist_invalidate(struct klist *); #else /* !_KERNEL */ diff --git a/sys/sys/eventvar.h b/sys/sys/eventvar.h index c288d49adbb..44338c5e38a 100644 --- a/sys/sys/eventvar.h +++ b/sys/sys/eventvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eventvar.h,v 1.8 2020/02/14 16:50:25 visa Exp $ */ +/* $OpenBSD: eventvar.h,v 1.9 2020/04/07 13:27:52 visa Exp $ */ /*- * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org> @@ -49,10 +49,10 @@ struct kqueue { LIST_ENTRY(kqueue) kq_next; - int kq_knlistsize; /* size of knlist */ - struct klist *kq_knlist; /* list of attached knotes */ - u_long kq_knhashmask; /* size of knhash */ - struct klist *kq_knhash; /* hash table for attached knotes */ + int kq_knlistsize; /* size of kq_knlist */ + struct knlist *kq_knlist; /* list of attached knotes */ + u_long kq_knhashmask; /* size of kq_knhash */ + struct knlist *kq_knhash; /* hash table for attached knotes */ struct task kq_task; /* deferring of activation */ int kq_state; diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c index ec6c704be25..c7a40d10333 100644 --- a/sys/tmpfs/tmpfs_vnops.c +++ b/sys/tmpfs/tmpfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpfs_vnops.c,v 1.39 2020/02/20 16:56:52 visa Exp $ */ +/* $OpenBSD: tmpfs_vnops.c,v 1.40 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */ /* @@ -2631,7 +2631,7 @@ tmpfs_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); return (0); } @@ -2641,7 +2641,7 @@ filt_tmpfsdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); } int diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index c623c9ba2a0..a651fa9f065 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.149 2020/02/27 09:10:31 mpi Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.150 2020/04/07 13:27:52 visa Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1934,7 +1934,7 @@ ufs_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - SLIST_INSERT_HEAD(&vp->v_selectinfo.si_note, kn, kn_selnext); + klist_insert(&vp->v_selectinfo.si_note, kn); return (0); } @@ -1944,7 +1944,7 @@ filt_ufsdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); + klist_remove(&vp->v_selectinfo.si_note, kn); } int |