diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-12-25 12:59:54 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-12-25 12:59:54 +0000 |
commit | 0ddae2e43bde351e699797b713fdfd0c4d71688b (patch) | |
tree | 5c305222f703a8c48618339303894fe5bf0e271e /sys/kern/uipc_socket.c | |
parent | d5d6ba970dd241df83e52a3f686a5b3c47e2b215 (diff) |
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/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 89ff3f5822e..edc2b1495a0 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.251 2020/12/12 11:48:54 jan Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.252 2020/12/25 12:59:52 visa Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -2040,7 +2040,7 @@ soo_kqfilter(struct file *fp, struct knote *kn) return (EINVAL); } - klist_insert(&sb->sb_sel.si_note, kn); + klist_insert_locked(&sb->sb_sel.si_note, kn); sb->sb_flagsintr |= SB_KNOTE; return (0); @@ -2053,7 +2053,7 @@ filt_sordetach(struct knote *kn) KERNEL_ASSERT_LOCKED(); - klist_remove(&so->so_rcv.sb_sel.si_note, kn); + klist_remove_locked(&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; } @@ -2106,7 +2106,7 @@ filt_sowdetach(struct knote *kn) KERNEL_ASSERT_LOCKED(); - klist_remove(&so->so_snd.sb_sel.si_note, kn); + klist_remove_locked(&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; } |