Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_shutdown.c
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, | ||||
CTLFLAG_RWTUN | CTLFLAG_SECURE, | CTLFLAG_RWTUN | CTLFLAG_SECURE, | ||||
&trace_on_panic, 0, "Print stack trace on kernel panic"); | &trace_on_panic, 0, "Print stack trace on kernel panic"); | ||||
#endif /* KDB */ | #endif /* KDB */ | ||||
static int sync_on_panic = 0; | static int sync_on_panic = 0; | ||||
SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RWTUN, | SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RWTUN, | ||||
&sync_on_panic, 0, "Do a sync before rebooting from a panic"); | &sync_on_panic, 0, "Do a sync before rebooting from a panic"); | ||||
static int poweroff_on_panic = 0; | |||||
SYSCTL_INT(_kern, OID_AUTO, poweroff_on_panic, CTLFLAG_RWTUN, | |||||
cem: we have SYSCTL_BOOL now, might as well use it. | |||||
impAuthorUnsubmitted Not Done Inline ActionsSure. With appropriate changes to the types. imp: Sure. With appropriate changes to the types. | |||||
&poweroff_on_panic, 0, "Do a power off instead of a reboot on a panic"); | |||||
static int powercycle_on_panic = 0; | |||||
SYSCTL_INT(_kern, OID_AUTO, powercycle_on_panic, CTLFLAG_RWTUN, | |||||
&powercycle_on_panic, 0, "Do a power cycle instead of a reboot on a panic"); | |||||
static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, | static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, | ||||
"Shutdown environment"); | "Shutdown environment"); | ||||
#ifndef DIAGNOSTIC | #ifndef DIAGNOSTIC | ||||
static int show_busybufs; | static int show_busybufs; | ||||
#else | #else | ||||
static int show_busybufs = 1; | static int show_busybufs = 1; | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 647 Lines • ▼ Show 20 Lines | #ifdef KDB | ||||
if (debugger_on_panic) | if (debugger_on_panic) | ||||
kdb_enter(KDB_WHY_PANIC, "panic"); | kdb_enter(KDB_WHY_PANIC, "panic"); | ||||
#endif | #endif | ||||
/*thread_lock(td); */ | /*thread_lock(td); */ | ||||
td->td_flags |= TDF_INPANIC; | td->td_flags |= TDF_INPANIC; | ||||
/* thread_unlock(td); */ | /* thread_unlock(td); */ | ||||
if (!sync_on_panic) | if (!sync_on_panic) | ||||
bootopt |= RB_NOSYNC; | bootopt |= RB_NOSYNC; | ||||
if (poweroff_on_panic) | |||||
bootopt |= RB_POWEROFF; | |||||
if (powercycle_on_panic) | |||||
bootopt |= RB_POWERCYCLE; | |||||
kern_reboot(bootopt); | kern_reboot(bootopt); | ||||
} | } | ||||
/* | /* | ||||
* Support for poweroff delay. | * Support for poweroff delay. | ||||
* | * | ||||
* Please note that setting this delay too short might power off your machine | * Please note that setting this delay too short might power off your machine | ||||
* before the write cache on your hard disk has been flushed, leading to | * before the write cache on your hard disk has been flushed, leading to | ||||
▲ Show 20 Lines • Show All 680 Lines • Show Last 20 Lines |
we have SYSCTL_BOOL now, might as well use it.