summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2014-01-08 02:19:39 +0000
committercperciva <cperciva@FreeBSD.org>2014-01-08 02:19:39 +0000
commit5190528326a1660f4975550150e35bfa7dd42396 (patch)
treefa87e25dc107f2928f187dc9d20d1d27882ead16
parentc4f2c365c9e2791fc74b817c70f98dc2846e5cbd (diff)
downloadFreeBSD-src-5190528326a1660f4975550150e35bfa7dd42396.zip
FreeBSD-src-5190528326a1660f4975550150e35bfa7dd42396.tar.gz
MFC r258893, r258956:
Add a new sysctl / loader tunable kern.panic_reboot_wait_time which defaults to PANIC_REBOOT_WAIT_TIME (a long-existing kernel config setting). Use this now-variable value in place of the defined constant to control how long the system waits after a panic before rebooting.
-rw-r--r--sys/kern/kern_shutdown.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index b120263..ddcf9ad 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -89,6 +89,11 @@ __FBSDID("$FreeBSD$");
#ifndef PANIC_REBOOT_WAIT_TIME
#define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */
#endif
+static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME;
+SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RW | CTLFLAG_TUN,
+ &panic_reboot_wait_time, 0,
+ "Seconds to wait before rebooting after a panic");
+TUNABLE_INT("kern.panic_reboot_wait_time", &panic_reboot_wait_time);
/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
@@ -485,12 +490,12 @@ shutdown_panic(void *junk, int howto)
int loop;
if (howto & RB_DUMP) {
- if (PANIC_REBOOT_WAIT_TIME != 0) {
- if (PANIC_REBOOT_WAIT_TIME != -1) {
+ if (panic_reboot_wait_time != 0) {
+ if (panic_reboot_wait_time != -1) {
printf("Automatic reboot in %d seconds - "
"press a key on the console to abort\n",
- PANIC_REBOOT_WAIT_TIME);
- for (loop = PANIC_REBOOT_WAIT_TIME * 10;
+ panic_reboot_wait_time);
+ for (loop = panic_reboot_wait_time * 10;
loop > 0; --loop) {
DELAY(1000 * 100); /* 1/10th second */
/* Did user type a key? */
OpenPOWER on IntegriCloud