1*800e7495SMitchell Horne.\" $NetBSD: boot.9,v 1.2 1996/09/24 07:01:26 ghudson Exp $ 2*800e7495SMitchell Horne.\" 3*800e7495SMitchell Horne.\" Copyright (c) 1997 4*800e7495SMitchell Horne.\" Mike Pritchard. All rights reserved. 5*800e7495SMitchell Horne.\" 6*800e7495SMitchell Horne.\" Copyright (c) 1994 Christopher G. Demetriou 7*800e7495SMitchell Horne.\" All rights reserved. 8*800e7495SMitchell Horne.\" 9*800e7495SMitchell Horne.\" Redistribution and use in source and binary forms, with or without 10*800e7495SMitchell Horne.\" modification, are permitted provided that the following conditions 11*800e7495SMitchell Horne.\" are met: 12*800e7495SMitchell Horne.\" 1. Redistributions of source code must retain the above copyright 13*800e7495SMitchell Horne.\" notice, this list of conditions and the following disclaimer. 14*800e7495SMitchell Horne.\" 2. Redistributions in binary form must reproduce the above copyright 15*800e7495SMitchell Horne.\" notice, this list of conditions and the following disclaimer in the 16*800e7495SMitchell Horne.\" documentation and/or other materials provided with the distribution. 17*800e7495SMitchell Horne.\" 3. All advertising materials mentioning features or use of this software 18*800e7495SMitchell Horne.\" must display the following acknowledgement: 19*800e7495SMitchell Horne.\" This product includes software developed by Christopher G. Demetriou 20*800e7495SMitchell Horne.\" for the NetBSD Project. 21*800e7495SMitchell Horne.\" 3. The name of the author may not be used to endorse or promote products 22*800e7495SMitchell Horne.\" derived from this software without specific prior written permission 23*800e7495SMitchell Horne.\" 24*800e7495SMitchell Horne.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25*800e7495SMitchell Horne.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26*800e7495SMitchell Horne.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27*800e7495SMitchell Horne.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28*800e7495SMitchell Horne.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29*800e7495SMitchell Horne.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30*800e7495SMitchell Horne.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31*800e7495SMitchell Horne.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32*800e7495SMitchell Horne.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33*800e7495SMitchell Horne.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34*800e7495SMitchell Horne.\" 35*800e7495SMitchell Horne.\" $FreeBSD$ 36*800e7495SMitchell Horne.\" 37*800e7495SMitchell Horne.Dd Sept 23, 2021 38*800e7495SMitchell Horne.Dt KERN_REBOOT 9 39*800e7495SMitchell Horne.Os 40*800e7495SMitchell Horne.Sh NAME 41*800e7495SMitchell Horne.Nm kern_reboot 42*800e7495SMitchell Horne.Nd halt or reboot the system 43*800e7495SMitchell Horne.Sh SYNOPSIS 44*800e7495SMitchell Horne.In sys/types.h 45*800e7495SMitchell Horne.In sys/systm.h 46*800e7495SMitchell Horne.In sys/reboot.h 47*800e7495SMitchell Horne.Ft void 48*800e7495SMitchell Horne.Fn kern_reboot "int howto" 49*800e7495SMitchell Horne.In sys/eventhandler.h 50*800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_pre_sync" "shutdown_fn" "private" "priority" 51*800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_post_sync" "shutdown_fn" "private" "priority" 52*800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_final" "shutdown_fn" "private" "priority" 53*800e7495SMitchell Horne.Sh DESCRIPTION 54*800e7495SMitchell HorneThe 55*800e7495SMitchell Horne.Fn kern_reboot 56*800e7495SMitchell Hornefunction handles final system shutdown, and either halts or reboots 57*800e7495SMitchell Hornethe system. 58*800e7495SMitchell HorneThe exact action to be taken is determined by the flags passed in 59*800e7495SMitchell Horne.Fa howto 60*800e7495SMitchell Horneand by whether or not the system has finished autoconfiguration. 61*800e7495SMitchell Horne.Pp 62*800e7495SMitchell HorneIf the system has finished autoconfiguration, 63*800e7495SMitchell Horne.Fn kern_reboot 64*800e7495SMitchell Hornedoes the following: 65*800e7495SMitchell Horne.Bl -enum -offset indent 66*800e7495SMitchell Horne.It 67*800e7495SMitchell HorneIf this is the first invocation of 68*800e7495SMitchell Horne.Fn kern_reboot 69*800e7495SMitchell Horneand the 70*800e7495SMitchell Horne.Dv RB_NOSYNC 71*800e7495SMitchell Horneflag is not set in 72*800e7495SMitchell Horne.Fa howto , 73*800e7495SMitchell Hornesyncs and unmounts the system disks by calling 74*800e7495SMitchell Horne.Xr vfs_unmountall 9 . 75*800e7495SMitchell Horne.It 76*800e7495SMitchell HorneDisables interrupts. 77*800e7495SMitchell Horne.It 78*800e7495SMitchell HorneIf rebooting after a crash (i.e., if 79*800e7495SMitchell Horne.Dv RB_DUMP 80*800e7495SMitchell Horneis set in 81*800e7495SMitchell Horne.Fa howto , 82*800e7495SMitchell Hornebut 83*800e7495SMitchell Horne.Dv RB_HALT 84*800e7495SMitchell Horneis not), saves a system crash dump. 85*800e7495SMitchell Horne.It 86*800e7495SMitchell HorneRuns any shutdown hooks previously registered. 87*800e7495SMitchell Horne.It 88*800e7495SMitchell HornePrints a message indicating that the system is about to be halted 89*800e7495SMitchell Horneor rebooted. 90*800e7495SMitchell Horne.It 91*800e7495SMitchell HorneIf 92*800e7495SMitchell Horne.Dv RB_HALT 93*800e7495SMitchell Horneis set in 94*800e7495SMitchell Horne.Fa howto , 95*800e7495SMitchell Hornehalts the system. 96*800e7495SMitchell HorneOtherwise, reboots the system. 97*800e7495SMitchell Horne.El 98*800e7495SMitchell Horne.Pp 99*800e7495SMitchell HorneIf the system has not finished autoconfiguration, 100*800e7495SMitchell Horne.Fn kern_reboot 101*800e7495SMitchell Horneruns any shutdown hooks previously registered, 102*800e7495SMitchell Horneprints a message, and halts the system. 103*800e7495SMitchell Horne.Sh RETURN VALUES 104*800e7495SMitchell HorneThe 105*800e7495SMitchell Horne.Fn kern_reboot 106*800e7495SMitchell Hornefunction does not return. 107*800e7495SMitchell Horne.Sh SEE ALSO 108*800e7495SMitchell Horne.Xr reboot 2 109*800e7495SMitchell Horne.Xr EVENTHANDLER 9 110*800e7495SMitchell Horne.Xr vfs_unmountall 9 111