Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2022 00:23:40 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 84ec7df0d796 - main - Add kern.reboot_wait_time sysctl
Message-ID:  <202207190023.26J0Neu0036518@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=84ec7df0d796ddab6301817e12904762e2724c8e

commit 84ec7df0d796ddab6301817e12904762e2724c8e
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2022-07-13 00:42:26 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2022-07-19 00:23:25 +0000

    Add kern.reboot_wait_time sysctl
    
    Historic FreeBSD behaviour (dating back to 1994-04-02) when rebooting
    is to print "Rebooting..." and then
            /* wait 1 sec for printf's to complete and be read */
    
    Prior to April 1994, there was a 100 ms delay (added 1993-11-12).
    
    Since (a) most users will already be aware that the system is rebooting
    and do not need to take time to read an additional message to that
    effect, and (b) most FreeBSD systems don't have anyone actively looking
    at the console anyway, this delay no longer serves much purpose.
    
    This commit adds a kern.reboot_wait_time sysctl which defaults to 0;
    historic behaviour can be regained by setting it to 1.
    
    Reviewed by:    imp
    Relnotes:       FreeBSD now reboots faster; to restore the traditional
                    wait after printing "Rebooting..." to the console, set
                    kern.reboot_wait_time=1 (or more).
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D35796
---
 sys/kern/kern_shutdown.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 87afc175a72d..ab37b54667f9 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -111,6 +111,10 @@ static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME;
 SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RWTUN,
     &panic_reboot_wait_time, 0,
     "Seconds to wait before rebooting after a panic");
+static int reboot_wait_time = 0;
+SYSCTL_INT(_kern, OID_AUTO, reboot_wait_time, CTLFLAG_RWTUN,
+    &reboot_wait_time, 0,
+    "Seconds to wait before rebooting");
 
 /*
  * Note that stdarg.h and the ANSI style va_start macro is used for both
@@ -710,7 +714,7 @@ shutdown_reset(void *junk, int howto)
 {
 
 	printf("Rebooting...\n");
-	DELAY(1000000);	/* wait 1 sec for printf's to complete and be read */
+	DELAY(reboot_wait_time * 1000000);
 
 	/*
 	 * Acquiring smp_ipi_mtx here has a double effect:



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