summaryrefslogtreecommitdiff
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-05-15 23:17:55 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-05-15 23:17:55 +0000
commit521b6d5ed6d0633e343be800c3599f0a5e72217a (patch)
tree02e3dd3e7b165d038303bd07ba57717af4db0454 /sys/kern/subr_prf.c
parent33bc70fe0c79cdb72d78b3044cf69a275b11a3b0 (diff)
Implement splassert() for sparc - a tool for finding problems related to
spl handling (already found 3 problems). Man page in a few seconds. deraadt@ ok.
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index b15cb472739..2a20170da5e 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_prf.c,v 1.40 2002/03/15 18:19:52 millert Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.41 2002/05/15 23:17:53 art Exp $ */
/* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */
/*-
@@ -131,6 +131,11 @@ int db_console = 0;
#endif
/*
+ * panic on spl assertion failure?
+ */
+int splassert_ctl = 0;
+
+/*
* v_putc: routine to putc on virtual console
*
* the v_putc pointer can be used to redirect the console cnputc elsewhere
@@ -219,6 +224,24 @@ panic(const char *fmt, ...)
}
/*
+ * We print only the function name. The file name is usually very long and
+ * would eat tons of space in the kernel.
+ */
+void
+splassert_fail(int wantipl, int haveipl, const char *func)
+{
+
+ printf("splassert: %s: want %d have %d\n", func, wantipl, haveipl);
+ if (splassert_ctl > 1) {
+ panic("spl assertion failure in %s", func);
+ } else {
+#ifdef DDB
+ /* Will print stack trace RSN. */
+#endif
+ }
+}
+
+/*
* kernel logging functions: log, logpri, addlog
*/