Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2013 21:35:26 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258893 - head/sys/kern
Message-ID:  <201312032135.rB3LZQbw001729@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Tue Dec  3 21:35:25 2013
New Revision: 258893
URL: http://svnweb.freebsd.org/changeset/base/258893

Log:
  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.

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Tue Dec  3 21:29:45 2013	(r258892)
+++ head/sys/kern/kern_shutdown.c	Tue Dec  3 21:35:25 2013	(r258893)
@@ -89,6 +89,11 @@ __FBSDID("$FreeBSD$");
 #ifndef PANIC_REBOOT_WAIT_TIME
 #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */
 #endif
+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? */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312032135.rB3LZQbw001729>