Use sel{record,remove}_knote().

This commit is contained in:
thorpej 2020-12-19 22:11:57 +00:00
parent 1142b3532f
commit 1c3a055871
2 changed files with 8 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: event.c,v 1.16 2020/05/23 23:42:41 ad Exp $ */ /* $NetBSD: event.c,v 1.17 2020/12/19 22:16:15 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.16 2020/05/23 23:42:41 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: event.c,v 1.17 2020/12/19 22:16:15 thorpej Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
@ -189,7 +189,7 @@ filt_evrdetach(struct knote *kn)
struct evvar *ev = kn->kn_hook; struct evvar *ev = kn->kn_hook;
mutex_enter(ev->ev_lock); mutex_enter(ev->ev_lock);
SLIST_REMOVE(&ev->ev_sel.sel_klist, kn, knote, kn_selnext); selremove_knote(&ev->ev_sel, kn);
mutex_exit(ev->ev_lock); mutex_exit(ev->ev_lock);
} }
@ -226,11 +226,9 @@ static const struct filterops ev_filtops = {
int int
ev_kqfilter(struct evvar *ev, struct knote *kn) ev_kqfilter(struct evvar *ev, struct knote *kn)
{ {
struct klist *klist;
switch (kn->kn_filter) { switch (kn->kn_filter) {
case EVFILT_READ: case EVFILT_READ:
klist = &ev->ev_sel.sel_klist;
kn->kn_fop = &ev_filtops; kn->kn_fop = &ev_filtops;
break; break;
@ -241,7 +239,7 @@ ev_kqfilter(struct evvar *ev, struct knote *kn)
kn->kn_hook = ev; kn->kn_hook = ev;
mutex_enter(ev->ev_lock); mutex_enter(ev->ev_lock);
SLIST_INSERT_HEAD(klist, kn, kn_selnext); selrecord_knote(&ev->ev_sel, kn);
mutex_exit(ev->ev_lock); mutex_exit(ev->ev_lock);
return (0); return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_psdev.c,v 1.58 2017/10/25 08:12:38 maya Exp $ */ /* $NetBSD: coda_psdev.c,v 1.59 2020/12/19 22:11:57 thorpej Exp $ */
/* /*
* *
@ -54,7 +54,7 @@
/* These routines are the device entry points for Venus. */ /* These routines are the device entry points for Venus. */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.58 2017/10/25 08:12:38 maya Exp $"); __KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.59 2020/12/19 22:11:57 thorpej Exp $");
extern int coda_nc_initialized; /* Set if cache has been initialized */ extern int coda_nc_initialized; /* Set if cache has been initialized */
@ -469,7 +469,7 @@ filt_vc_nb_detach(struct knote *kn)
{ {
struct vcomm *vcp = kn->kn_hook; struct vcomm *vcp = kn->kn_hook;
SLIST_REMOVE(&vcp->vc_selproc.sel_klist, kn, knote, kn_selnext); selremove_knote(&vcp->vc_selproc, kn);
} }
static int static int
@ -497,7 +497,6 @@ int
vc_nb_kqfilter(dev_t dev, struct knote *kn) vc_nb_kqfilter(dev_t dev, struct knote *kn)
{ {
struct vcomm *vcp; struct vcomm *vcp;
struct klist *klist;
ENTRY; ENTRY;
@ -508,7 +507,6 @@ vc_nb_kqfilter(dev_t dev, struct knote *kn)
switch (kn->kn_filter) { switch (kn->kn_filter) {
case EVFILT_READ: case EVFILT_READ:
klist = &vcp->vc_selproc.sel_klist;
kn->kn_fop = &vc_nb_read_filtops; kn->kn_fop = &vc_nb_read_filtops;
break; break;
@ -518,7 +516,7 @@ vc_nb_kqfilter(dev_t dev, struct knote *kn)
kn->kn_hook = vcp; kn->kn_hook = vcp;
SLIST_INSERT_HEAD(klist, kn, kn_selnext); selrecord_knote(&vcp->vc_selproc, kn);
return (0); return (0);
} }