summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-01-08 17:31:30 +0000
committereivind <eivind@FreeBSD.org>1999-01-08 17:31:30 +0000
commita8dc66f457be84eefbe16e70c901ceb11137ba65 (patch)
treee5747f527c552fa90334c779c047697b372582fb /sys/kern/kern_synch.c
parent1c69824749ed0aa6efce159d39ab3f17fc9e25f2 (diff)
downloadFreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.zip
FreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.tar.gz
Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT as
discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c41
1 files changed, 6 insertions, 35 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 17b2a94..3a9391d 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.69 1998/11/27 11:44:22 dg Exp $
+ * $Id: kern_synch.c,v 1.70 1998/12/21 07:41:51 dillon Exp $
*/
#include "opt_ktrace.h"
@@ -401,20 +401,11 @@ tsleep(ident, priority, wmesg, timo)
splx(s);
return (0);
}
-#ifdef DIAGNOSTIC
- if(p == NULL)
- panic("tsleep1");
- if (ident == NULL || p->p_stat != SRUN)
- panic("tsleep");
- /* XXX This is not exhaustive, just the most common case */
-#ifdef NOTDEF
- /*
- * This can happen legitimately now with asleep()/await()
- */
- if ((p->p_procq.tqe_prev != NULL) && (*p->p_procq.tqe_prev == p))
- panic("sleeping process already on another queue");
-#endif
-#endif
+
+ KASSERT(p != NULL, ("tsleep1"));
+ KASSERT(ident != NULL && p->p_stat == SRUN,
+ ("tsleep"));
+
/*
* Process may be sitting on a slpque if asleep() was called, remove
* it before re-adding.
@@ -706,16 +697,6 @@ wakeup(ident)
qp = &slpque[LOOKUP(ident)];
restart:
for (p = qp->tqh_first; p != NULL; p = p->p_procq.tqe_next) {
-#ifdef DIAGNOSTIC
-#ifdef NOTDEF
- /*
- * The process can legitimately be running now with
- * asleep()/await().
- */
- if (p->p_stat != SSLEEP && p->p_stat != SSTOP)
- panic("wakeup");
-#endif
-#endif
if (p->p_wchan == ident) {
TAILQ_REMOVE(qp, p, p_procq);
p->p_wchan = 0;
@@ -757,16 +738,6 @@ wakeup_one(ident)
qp = &slpque[LOOKUP(ident)];
for (p = qp->tqh_first; p != NULL; p = p->p_procq.tqe_next) {
-#ifdef DIAGNOSTIC
-#ifdef NOTDEF
- /*
- * The process can legitimately be running now with
- * asleep()/await().
- */
- if (p->p_stat != SSLEEP && p->p_stat != SSTOP)
- panic("wakeup_one");
-#endif
-#endif
if (p->p_wchan == ident) {
TAILQ_REMOVE(qp, p, p_procq);
p->p_wchan = 0;
OpenPOWER on IntegriCloud