From owner-dev-commits-src-branches@freebsd.org Mon Oct 4 14:12:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A273067FE8B; Mon, 4 Oct 2021 14:12:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HNN2Y1rk6z4qpt; Mon, 4 Oct 2021 14:12:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFBCB1A8CF; Mon, 4 Oct 2021 14:12:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 194ECKG8048916; Mon, 4 Oct 2021 14:12:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 194ECKo0048915; Mon, 4 Oct 2021 14:12:20 GMT (envelope-from git) Date: Mon, 4 Oct 2021 14:12:20 GMT Message-Id: <202110041412.194ECKo0048915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 68628f462093 - stable/13 - boot(9): update to match reality MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 68628f46209356895110411777ac387329e1ed20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2021 14:12:21 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=68628f46209356895110411777ac387329e1ed20 commit 68628f46209356895110411777ac387329e1ed20 Author: Mitchell Horne AuthorDate: 2021-09-28 14:36:09 +0000 Commit: Mitchell Horne CommitDate: 2021-10-04 14:11:06 +0000 boot(9): update to match reality This function was renamed to kern_reboot() in 2010, but the man page has failed to keep in sync. Bring it up to date on the rename, add the shutdown hooks to the synopsis, and document the (obvious) fact that kern_reboot() does not return. Fix an outdated reference to the old name in kern_reboot(), and leave a reference to the man page so future readers might find it before any large changes. Reviewed by: imp, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32085 (cherry picked from commit 800e74955d4e5f90e7258956ba42228350f71049) --- ObsoleteFiles.inc | 3 +++ share/man/man9/Makefile | 2 +- share/man/man9/{boot.9 => kern_reboot.9} | 26 ++++++++++++++++++-------- sys/kern/kern_shutdown.c | 5 +++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 843bc0326a41..a721f5596031 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210923: rename boot(9) to kern_reboot(9) +OLD_FILES+=usr/share/man/man9/boot.9.gz + # 20210810: remove Pentium-related man pages and references OLD_FILES+=usr/share/man/man3/pmc.p4.3.gz OLD_FILES+=usr/share/man/man3/pmc.p5.3.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 43bf82426a73..ae5efa65bd0b 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -15,7 +15,6 @@ MAN= accept_filter.9 \ bhnd_erom.9 \ bios.9 \ bitset.9 \ - boot.9 \ bpf.9 \ buf.9 \ buf_ring.9 \ @@ -188,6 +187,7 @@ MAN= accept_filter.9 \ intro.9 \ ithread.9 \ KASSERT.9 \ + kern_reboot.9 \ kern_testfrwk.9 \ kernacc.9 \ kernel_mount.9 \ diff --git a/share/man/man9/boot.9 b/share/man/man9/kern_reboot.9 similarity index 85% rename from share/man/man9/boot.9 rename to share/man/man9/kern_reboot.9 index cbd0099e4e18..587d4ab114db 100644 --- a/share/man/man9/boot.9 +++ b/share/man/man9/kern_reboot.9 @@ -34,21 +34,25 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 1997 -.Dt BOOT 9 +.Dd Sept 23, 2021 +.Dt KERN_REBOOT 9 .Os .Sh NAME -.Nm boot +.Nm kern_reboot .Nd halt or reboot the system .Sh SYNOPSIS .In sys/types.h .In sys/systm.h .In sys/reboot.h .Ft void -.Fn boot "int howto" +.Fn kern_reboot "int howto" +.In sys/eventhandler.h +.Fn EVENTHANDLER_REGISTER "shutdown_pre_sync" "shutdown_fn" "private" "priority" +.Fn EVENTHANDLER_REGISTER "shutdown_post_sync" "shutdown_fn" "private" "priority" +.Fn EVENTHANDLER_REGISTER "shutdown_final" "shutdown_fn" "private" "priority" .Sh DESCRIPTION The -.Fn boot +.Fn kern_reboot function handles final system shutdown, and either halts or reboots the system. The exact action to be taken is determined by the flags passed in @@ -56,12 +60,12 @@ The exact action to be taken is determined by the flags passed in and by whether or not the system has finished autoconfiguration. .Pp If the system has finished autoconfiguration, -.Fn boot +.Fn kern_reboot does the following: .Bl -enum -offset indent .It If this is the first invocation of -.Fn boot +.Fn kern_reboot and the .Dv RB_NOSYNC flag is not set in @@ -93,8 +97,14 @@ Otherwise, reboots the system. .El .Pp If the system has not finished autoconfiguration, -.Fn boot +.Fn kern_reboot runs any shutdown hooks previously registered, prints a message, and halts the system. +.Sh RETURN VALUES +The +.Fn kern_reboot +function does not return. .Sh SEE ALSO +.Xr reboot 2 +.Xr EVENTHANDLER 9 .Xr vfs_unmountall 9 diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index fb2a69401801..eb2d41fedd42 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -421,7 +421,8 @@ doadump(boolean_t textdump) } /* - * Shutdown the system cleanly to prepare for reboot, halt, or power off. + * kern_reboot(9): Shut down the system cleanly to prepare for reboot, halt, or + * power off. */ void kern_reboot(int howto) @@ -450,7 +451,7 @@ kern_reboot(int howto) sched_bind(curthread, CPU_FIRST()); thread_unlock(curthread); KASSERT(PCPU_GET(cpuid) == CPU_FIRST(), - ("boot: not running on cpu 0")); + ("%s: not running on cpu 0", __func__)); } #endif /* We're in the process of rebooting. */