xref: /openbsd/share/man/man9/boot.9 (revision 78b63d65)
1.\"	$OpenBSD: boot.9,v 1.5 2000/10/12 18:05:58 aaron Exp $
2.\"	$NetBSD: boot.9,v 1.1 1995/11/25 21:24:48 perry Exp $
3.\"
4.\" Copyright (c) 1994 Christopher G. Demetriou
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"      This product includes software developed by Christopher G. Demetriou
18.\"      for the NetBSD Project.
19.\" 3. The name of the author may not be used to endorse or promote products
20.\"    derived from this software without specific prior written permission
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32.\"
33.Dd November 13, 1995
34.Dt BOOT 9
35.Os
36.Sh NAME
37.Nm boot
38.Nd halt or reboot the system
39.Sh SYNOPSIS
40.Fd #include <sys/reboot.h>
41.Ft void
42.Fn boot "int howto"
43.Sh DESCRIPTION
44The
45.Fn boot
46function handles final system shutdown, and either halts or reboots
47the system.
48The exact action to be taken is determined by the flags passed in
49.Fa howto
50and by whether or not the system has finished autoconfiguration.
51.Pp
52If the system has finished autoconfiguration,
53.Fn boot
54does the following:
55.Bl -enum -offset indent
56.It
57Sets the
58.Va boothowto
59system variable from the
60.Fa howto
61argument.
62.It
63If this is the first invocation of
64.Fn boot
65and the
66.Dv RB_NOSYNC
67flag is not set in
68.Fa howto ,
69syncs and unmounts the system disks by calling
70.Xr vfs_shutdown 9
71and sets the time of day clock by calling
72.Xr resettodr 9 .
73.It
74Disables interrupts.
75.It
76If rebooting after a crash (i.e., if
77.Dv RB_DUMP
78is set in
79.Fa howto ,
80but
81.Dv RB_HALT
82is not), saves a system crash dump.
83.It
84Runs any shutdown hooks by calling
85.Xr doshutdownhooks 9 .
86.It
87Prints a message indicating that the system is about to be halted
88or rebooted.
89.It
90If
91.Dv RB_HALT
92is set in
93.Fa howto ,
94halts the system.
95Otherwise, reboots the system.
96.El
97.Pp
98If the system has not finished autoconfiguration,
99.Fn boot
100runs any shutdown hooks by calling
101.Xr doshutdownhooks 9 ,
102prints a message, and halts the system.
103.Sh SEE ALSO
104.Xr doshutdownhooks 9 ,
105.Xr resettodr 9 ,
106.Xr vfs_shutdown 9
107