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.
This commit is contained in:
Mateusz Guzik 2020-01-12 06:09:10 +00:00
parent 879e0604ee
commit d199ad3b44
2 changed files with 5 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 */