Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_shutdown.c
Show First 20 Lines • Show All 608 Lines • ▼ Show 20 Lines | kassert_sysctl_kassert(SYSCTL_HANDLER_ARGS) | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Called by KASSERT, this decides if we will panic | * Called by KASSERT, this decides if we will panic | ||||
* or if we will log via printf and/or ktr. | * or if we will log via printf and/or ktr. | ||||
*/ | */ | ||||
void | void | ||||
kassert_panic(const char *fmt, ...) | _kassert_panic(int fatal, const char *fmt, ...) | ||||
ngie: Should "fatal" be boolean? | |||||
bdreweryAuthorUnsubmitted Not Done Inline ActionsI'm not sure. I almost went with boolean but am unclear on its acceptance in kernel code. bdrewery: I'm not sure. I almost went with boolean but am unclear on its acceptance in kernel code. | |||||
emasteUnsubmitted Not Done Inline Actionsstyle(9) now mentions boolean, and for new code I believe we should use it. emaste: style(9) now mentions boolean, and for new code I believe we should use it. | |||||
{ | { | ||||
static char buf[256]; | static char buf[256]; | ||||
va_list ap; | va_list ap; | ||||
va_start(ap, fmt); | va_start(ap, fmt); | ||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap); | (void)vsnprintf(buf, sizeof(buf), fmt, ap); | ||||
va_end(ap); | va_end(ap); | ||||
/* | /* | ||||
* panic if we're not just warning, or if we've exceeded | * panic if we're not just warning, or if we've exceeded | ||||
* kassert_log_panic_at warnings. | * kassert_log_panic_at warnings. | ||||
ngieUnsubmitted Not Done Inline ActionsI would update the comment here to add in "fatal". ngie: I would update the comment here to add in "fatal". | |||||
*/ | */ | ||||
if (!kassert_warn_only || | if (fatal && (!kassert_warn_only || | ||||
(kassert_log_panic_at > 0 && | (kassert_log_panic_at > 0 && | ||||
kassert_warnings >= kassert_log_panic_at)) { | kassert_warnings >= kassert_log_panic_at))) { | ||||
va_start(ap, fmt); | va_start(ap, fmt); | ||||
vpanic(fmt, ap); | vpanic(fmt, ap); | ||||
/* NORETURN */ | /* NORETURN */ | ||||
} | } | ||||
#ifdef KTR | #ifdef KTR | ||||
if (kassert_do_ktr) | if (kassert_do_ktr) | ||||
CTR0(ktr_mask, buf); | CTR0(ktr_mask, buf); | ||||
#endif /* KTR */ | #endif /* KTR */ | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |
Should "fatal" be boolean?