aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-01-12 06:09:10 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-01-12 06:09:10 +0000
commitd199ad3b44395aebd2b1597bf5e13b719ca7daab (patch)
treeb0729d0aab5cdb4ecd92c969fb158fa27f0637b4 /sys
parent879e0604ee6ac0ded87f6754141e7af25f4b7d5a (diff)
downloadsrc-d199ad3b44395aebd2b1597bf5e13b719ca7daab.tar.gz
src-d199ad3b44395aebd2b1597bf5e13b719ca7daab.zip
Add "panicked" boolean which can be tested instead of panicstr
The test is performed all the time and reading entire panicstr to do it wastes space.
Notes
Notes: svn path=/head/; revision=356656
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_shutdown.c4
-rw-r--r--sys/sys/systm.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index da3f84bf69a5..c3455960b7b4 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -217,7 +217,8 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLAG_RWTUN,
* Variable panicstr contains argument to first call to panic; used as flag
* to indicate that the kernel has already called panic.
*/
-const char __read_mostly *panicstr;
+const char *panicstr;
+bool __read_frequently panicked;
int __read_mostly dumping; /* system is dumping */
int rebooting; /* system is rebooting */
@@ -873,6 +874,7 @@ vpanic(const char *fmt, va_list ap)
else {
bootopt |= RB_DUMP;
panicstr = fmt;
+ panicked = true;
newpanic = 1;
}
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 0177a6e20b7a..dc95f26dc9af 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -53,7 +53,8 @@ extern int cold; /* nonzero if we are doing a cold boot */
extern int suspend_blocked; /* block suspend due to pending shutdown */
extern int rebooting; /* kern_reboot() has been called. */
extern const char *panicstr; /* panic message */
-#define KERNEL_PANICKED() __predict_false(panicstr != NULL)
+extern bool panicked;
+#define KERNEL_PANICKED() __predict_false(panicked)
extern char version[]; /* system version */
extern char compiler_version[]; /* compiler version */
extern char copyright[]; /* system copyright */