xref: /freebsd/share/man/man9/kern_reboot.9 (revision 320686674b3c8ce3ffe135c421a22d063917ee46)
1800e7495SMitchell Horne.\"	$NetBSD: boot.9,v 1.2 1996/09/24 07:01:26 ghudson Exp $
2800e7495SMitchell Horne.\"
3800e7495SMitchell Horne.\" Copyright (c) 1997
4800e7495SMitchell Horne.\" 	Mike Pritchard.  All rights reserved.
5800e7495SMitchell Horne.\"
6800e7495SMitchell Horne.\" Copyright (c) 1994 Christopher G. Demetriou
7800e7495SMitchell Horne.\" All rights reserved.
8800e7495SMitchell Horne.\"
9800e7495SMitchell Horne.\" Redistribution and use in source and binary forms, with or without
10800e7495SMitchell Horne.\" modification, are permitted provided that the following conditions
11800e7495SMitchell Horne.\" are met:
12800e7495SMitchell Horne.\" 1. Redistributions of source code must retain the above copyright
13800e7495SMitchell Horne.\"    notice, this list of conditions and the following disclaimer.
14800e7495SMitchell Horne.\" 2. Redistributions in binary form must reproduce the above copyright
15800e7495SMitchell Horne.\"    notice, this list of conditions and the following disclaimer in the
16800e7495SMitchell Horne.\"    documentation and/or other materials provided with the distribution.
17800e7495SMitchell Horne.\" 3. All advertising materials mentioning features or use of this software
18800e7495SMitchell Horne.\"    must display the following acknowledgement:
19800e7495SMitchell Horne.\"      This product includes software developed by Christopher G. Demetriou
20800e7495SMitchell Horne.\"      for the NetBSD Project.
21800e7495SMitchell Horne.\" 3. The name of the author may not be used to endorse or promote products
22800e7495SMitchell Horne.\"    derived from this software without specific prior written permission
23800e7495SMitchell Horne.\"
24800e7495SMitchell Horne.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25800e7495SMitchell Horne.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26800e7495SMitchell Horne.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27800e7495SMitchell Horne.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28800e7495SMitchell Horne.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29800e7495SMitchell Horne.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30800e7495SMitchell Horne.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31800e7495SMitchell Horne.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32800e7495SMitchell Horne.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33800e7495SMitchell Horne.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34800e7495SMitchell Horne.\"
35800e7495SMitchell Horne.\" $FreeBSD$
36800e7495SMitchell Horne.\"
37*32068667SChristian Brueffer.Dd September 23, 2021
38800e7495SMitchell Horne.Dt KERN_REBOOT 9
39800e7495SMitchell Horne.Os
40800e7495SMitchell Horne.Sh NAME
41800e7495SMitchell Horne.Nm kern_reboot
42800e7495SMitchell Horne.Nd halt or reboot the system
43800e7495SMitchell Horne.Sh SYNOPSIS
44800e7495SMitchell Horne.In sys/types.h
45800e7495SMitchell Horne.In sys/systm.h
46800e7495SMitchell Horne.In sys/reboot.h
47800e7495SMitchell Horne.Ft void
48800e7495SMitchell Horne.Fn kern_reboot "int howto"
49800e7495SMitchell Horne.In sys/eventhandler.h
50800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_pre_sync" "shutdown_fn" "private" "priority"
51800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_post_sync" "shutdown_fn" "private" "priority"
52800e7495SMitchell Horne.Fn EVENTHANDLER_REGISTER "shutdown_final" "shutdown_fn" "private" "priority"
53800e7495SMitchell Horne.Sh DESCRIPTION
54800e7495SMitchell HorneThe
55800e7495SMitchell Horne.Fn kern_reboot
56800e7495SMitchell Hornefunction handles final system shutdown, and either halts or reboots
57800e7495SMitchell Hornethe system.
58800e7495SMitchell HorneThe exact action to be taken is determined by the flags passed in
59800e7495SMitchell Horne.Fa howto
60800e7495SMitchell Horneand by whether or not the system has finished autoconfiguration.
61800e7495SMitchell Horne.Pp
62800e7495SMitchell HorneIf the system has finished autoconfiguration,
63800e7495SMitchell Horne.Fn kern_reboot
64800e7495SMitchell Hornedoes the following:
65800e7495SMitchell Horne.Bl -enum -offset indent
66800e7495SMitchell Horne.It
67800e7495SMitchell HorneIf this is the first invocation of
68800e7495SMitchell Horne.Fn kern_reboot
69800e7495SMitchell Horneand the
70800e7495SMitchell Horne.Dv RB_NOSYNC
71800e7495SMitchell Horneflag is not set in
72800e7495SMitchell Horne.Fa howto ,
73800e7495SMitchell Hornesyncs and unmounts the system disks by calling
74800e7495SMitchell Horne.Xr vfs_unmountall 9 .
75800e7495SMitchell Horne.It
76800e7495SMitchell HorneDisables interrupts.
77800e7495SMitchell Horne.It
78800e7495SMitchell HorneIf rebooting after a crash (i.e., if
79800e7495SMitchell Horne.Dv RB_DUMP
80800e7495SMitchell Horneis set in
81800e7495SMitchell Horne.Fa howto ,
82800e7495SMitchell Hornebut
83800e7495SMitchell Horne.Dv RB_HALT
84800e7495SMitchell Horneis not), saves a system crash dump.
85800e7495SMitchell Horne.It
86800e7495SMitchell HorneRuns any shutdown hooks previously registered.
87800e7495SMitchell Horne.It
88800e7495SMitchell HornePrints a message indicating that the system is about to be halted
89800e7495SMitchell Horneor rebooted.
90800e7495SMitchell Horne.It
91800e7495SMitchell HorneIf
92800e7495SMitchell Horne.Dv RB_HALT
93800e7495SMitchell Horneis set in
94800e7495SMitchell Horne.Fa howto ,
95800e7495SMitchell Hornehalts the system.
96800e7495SMitchell HorneOtherwise, reboots the system.
97800e7495SMitchell Horne.El
98800e7495SMitchell Horne.Pp
99800e7495SMitchell HorneIf the system has not finished autoconfiguration,
100800e7495SMitchell Horne.Fn kern_reboot
101800e7495SMitchell Horneruns any shutdown hooks previously registered,
102800e7495SMitchell Horneprints a message, and halts the system.
103800e7495SMitchell Horne.Sh RETURN VALUES
104800e7495SMitchell HorneThe
105800e7495SMitchell Horne.Fn kern_reboot
106800e7495SMitchell Hornefunction does not return.
107800e7495SMitchell Horne.Sh SEE ALSO
108*32068667SChristian Brueffer.Xr reboot 2 ,
109*32068667SChristian Brueffer.Xr EVENTHANDLER 9 ,
110800e7495SMitchell Horne.Xr vfs_unmountall 9
111