summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1997-08-13 19:29:33 +0000
committerjulian <julian@FreeBSD.org>1997-08-13 19:29:33 +0000
commit0d371398d74dd205808caafce0fe3b2e440ef9ec (patch)
treee6865ca0f445fcaaaf6d02a3ff8d0f6ae7cde653 /sys/kern
parentcc75a271bab35009c4bb2e3aaa4c81a37c2db9e7 (diff)
downloadFreeBSD-src-0d371398d74dd205808caafce0fe3b2e440ef9ec.zip
FreeBSD-src-0d371398d74dd205808caafce0fe3b2e440ef9ec.tar.gz
add a diagnostic to catch some common cases of tsleep being
called from the wrong place.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_synch.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 2479c6a4..c96603c 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.32 1997/06/22 16:04:18 peter Exp $
+ * $Id: kern_synch.c,v 1.33 1997/08/08 22:48:57 julian Exp $
*/
#include "opt_ktrace.h"
@@ -349,8 +349,15 @@ tsleep(ident, priority, wmesg, timo)
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 */
+ if ((p->p_procq.tqe_next != NULL)
+ && (p->p_procq.tqe_next == p->p_procq.tqe_prev)
+ && (*p->p_procq.tqe_prev == p))
+ panic("sleeping process on run queue");
#endif
p->p_wchan = ident;
p->p_wmesg = wmesg;
OpenPOWER on IntegriCloud