summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2020-12-25 12:59:51 +0000
committervisa <visa@openbsd.org>2020-12-25 12:59:51 +0000
commit9b0cf67b268a857fffa6a742ad6be57acdc35301 (patch)
treecdb461f14f3d46558aedb56eba5cc939b03dad6f /sys/kern/tty.c
parentSmall smr_grace_wait() optimization (diff)
downloadwireguard-openbsd-9b0cf67b268a857fffa6a742ad6be57acdc35301.tar.xz
wireguard-openbsd-9b0cf67b268a857fffa6a742ad6be57acdc35301.zip
Refactor klist insertion and removal
Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 40ca90eb952..bbeff325b9e 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.165 2020/12/07 16:55:29 mpi Exp $ */
+/* $OpenBSD: tty.c,v 1.166 2020/12/25 12:59:52 visa Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -1133,7 +1133,7 @@ ttkqfilter(dev_t dev, struct knote *kn)
kn->kn_hook = tp;
s = spltty();
- klist_insert(klist, kn);
+ klist_insert_locked(klist, kn);
splx(s);
return (0);
@@ -1146,7 +1146,7 @@ filt_ttyrdetach(struct knote *kn)
int s;
s = spltty();
- klist_remove(&tp->t_rsel.si_note, kn);
+ klist_remove_locked(&tp->t_rsel.si_note, kn);
splx(s);
}
@@ -1175,7 +1175,7 @@ filt_ttywdetach(struct knote *kn)
int s;
s = spltty();
- klist_remove(&tp->t_wsel.si_note, kn);
+ klist_remove_locked(&tp->t_wsel.si_note, kn);
splx(s);
}