Date: Mon, 02 Dec 2013 00:26:46 -0800 From: Colin Percival <cperciva@freebsd.org> To: FreeBSD current <freebsd-current@freebsd.org> Subject: making PANIC_REBOOT_WAIT_TIME a tunable Message-ID: <529C4446.6020508@freebsd.org>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------010603050706050309040401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all, It seems that PANIC_REBOOT_WAIT_TIME has been a compile-time setting forever; and I can't see any reason for this, but I assume there was one... at some point in the distant past. The attached patch makes it a loader tunable and sysctl. My reason for wanting this is to make EC2 images reboot faster after a panic (not that it happens very often, of course) -- there's no point waiting for a key press at the console because the EC2 console is output-only. Any objections? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid --------------010603050706050309040401 Content-Type: text/plain; charset=us-ascii; name="panic-wait-time-sysctl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="panic-wait-time-sysctl.patch" Index: sys/kern/kern_shutdown.c =================================================================== --- sys/kern/kern_shutdown.c (revision 258085) +++ sys/kern/kern_shutdown.c (working copy) @@ -89,6 +89,11 @@ #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 @@ 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? */ --------------010603050706050309040401--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?529C4446.6020508>