summaryrefslogtreecommitdiff
path: root/sys/kern
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
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')
-rw-r--r--sys/kern/kern_sysctl.c5
-rw-r--r--sys/kern/subr_prf.c25
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 99b50f6d300..d56f03df0f7 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.64 2002/03/14 20:31:31 mickey Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.65 2002/05/15 23:17:53 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -433,6 +433,9 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_int(oldp, oldlenp, newp, newlen,
&cryptodevallowsoft));
#endif
+ case KERN_SPLASSERT:
+ return (sysctl_int(oldp, oldlenp, newp, newlen,
+ &splassert_ctl));
default:
return (EOPNOTSUPP);
}
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
*/