summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authoruebayasi <uebayasi@openbsd.org>2014-07-13 15:46:21 +0000
committeruebayasi <uebayasi@openbsd.org>2014-07-13 15:46:21 +0000
commitca86693be28e7194ad1cf3f628004f98c872ec26 (patch)
tree22a76b053ff4f3cdc168c0dcad1a598c82894ecc /sys/kern/kern_sig.c
parentOPENSSL_{malloc,free} -> {malloc,free} (diff)
downloadwireguard-openbsd-ca86693be28e7194ad1cf3f628004f98c872ec26.tar.xz
wireguard-openbsd-ca86693be28e7194ad1cf3f628004f98c872ec26.zip
KERNEL_ASSERT_LOCKED(9): Assertion for kernel lock (Rev. 3)
This adds a new assertion macro, KERNEL_ASSERT_LOCKED(), to assert that kernel_lock is held. In the long process of removing kernel_lock, there will be a lot (hundreds or thousands) of use of this; virtually almost all functions in !MP-safe subsystems should have this assertion. Thus this assertion should have a short, good name. Not only that "KERNEL_ASSERT_LOCKED" is consistent with other KERNEL_* and SCHED_ASSERT_LOCKED() macros. Input from dlg@ guenther@ kettenis@. OK dlg@ guenther@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 28ebd811904..970507f28b6 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.171 2014/07/12 21:21:19 matthew Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.172 2014/07/13 15:46:21 uebayasi Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1897,9 +1897,7 @@ single_thread_set(struct proc *p, enum single_thread_mode mode, int deep)
struct proc *q;
int error;
-#ifdef MULTIPROCESSOR
- KASSERT(__mp_lock_held(&kernel_lock));
-#endif
+ KERNEL_ASSERT_LOCKED();
if ((error = single_thread_check(p, deep)))
return error;
@@ -1996,9 +1994,7 @@ single_thread_clear(struct proc *p, int flag)
struct proc *q;
KASSERT(pr->ps_single == p);
-#ifdef MULTIPROCESSOR
- KASSERT(__mp_lock_held(&kernel_lock));
-#endif
+ KERNEL_ASSERT_LOCKED();
pr->ps_single = NULL;
atomic_clearbits_int(&pr->ps_flags, PS_SINGLEUNWIND | PS_SINGLEEXIT);