xref: /dragonfly/lib/libc/sys/reboot.2 (revision ffe53622)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)reboot.2	8.1 (Berkeley) 6/4/93
29.\" $FreeBSD: src/lib/libc/sys/reboot.2,v 1.9.2.4 2001/12/14 18:34:01 ru Exp $
30.\"
31.Dd November 23, 2017
32.Dt REBOOT 2
33.Os
34.Sh NAME
35.Nm reboot
36.Nd reboot system or halt processor
37.Sh LIBRARY
38.Lb libc
39.Sh SYNOPSIS
40.In unistd.h
41.In sys/reboot.h
42.Ft int
43.Fn reboot "int howto"
44.Sh DESCRIPTION
45.Fn Reboot
46reboots the system.
47Only the super-user may reboot a machine on demand.
48However, a reboot is invoked
49automatically in the event of unrecoverable system failures.
50.Pp
51.Fa Howto
52is a mask of options; the system call interface allows the following
53options, defined in the include file
54.In sys/reboot.h ,
55to be passed
56to the new kernel or the new bootstrap and init programs.
57.Bl -tag -width RB_INITNAMEA
58.It Dv RB_AUTOBOOT
59The default, causing the system to reboot in its usual fashion.
60.It Dv RB_ASKNAME
61Interpreted by the bootstrap program itself, causing it to
62prompt on the console as to what file should be booted.
63Normally, the system is booted from the file
64.Dq Em xx Ns No (0,0)kernel ,
65where
66.Em xx
67is the default disk name,
68without prompting for the file name.
69.It Dv RB_DFLTROOT
70Use the compiled in root device.
71Normally, the system uses the device from which it was booted
72as the root device if possible.
73(The default behavior is dependent on the ability of the bootstrap program
74to determine the drive from which it was loaded, which is not possible
75on all systems.)
76.It Dv RB_DUMP
77Dump kernel memory before rebooting; see
78.Xr savecore 8
79for more information.
80.It Dv RB_HALT
81the processor is simply halted; no reboot takes place.
82This option should be used with caution.
83.It Dv RB_POWEROFF
84After halting, the shutdown code will do what it can to turn
85off the power.
86This requires hardware support.
87.It Dv RB_INITNAME
88An option allowing the specification of an init program (see
89.Xr init 8 )
90other than
91.Pa /sbin/init
92to be run when the system reboots.
93This switch is not currently available.
94.It Dv RB_KDB
95Load the symbol table and enable a built-in debugger in the system.
96This option will have no useful function if the kernel is not configured
97for debugging.
98Several other options have different meaning if combined
99with this option, although their use may not be possible
100via the
101.Fn reboot
102call.
103See
104.Xr ddb 4
105for more information.
106.It Dv RB_NOSYNC
107Normally, the disks are sync'd (see
108.Xr sync 8 )
109before the processor is halted or rebooted.
110This option may be useful if file system changes have been made manually
111or if the processor is on fire.
112.It Dv RB_RDONLY
113Initially mount the root file system read-only.
114This is currently the default, and this option has been deprecated.
115.It Dv RB_SINGLE
116Normally, the reboot procedure involves an automatic disk consistency
117check and then multi-user operations.
118.Dv RB_SINGLE
119prevents this, booting the system with a single-user shell
120on the console.
121.Dv RB_SINGLE
122is actually interpreted by the
123.Xr init 8
124program in the newly booted system.
125.El
126.Pp
127When no options are given (i.e.,
128.Dv RB_AUTOBOOT
129is used), the system is
130rebooted from file
131.Dq kernel
132in the root file system of unit 0
133of a disk chosen in a processor specific way.
134An automatic consistency check of the disks is normally performed
135(see
136.Xr fsck 8 ) .
137.Sh RETURN VALUES
138If successful, this call never returns.
139Otherwise, a -1 is returned and an error is returned in the global
140variable
141.Va errno .
142.Sh ERRORS
143.Bl -tag -width Er
144.It Bq Er EPERM
145The caller is not the super-user.
146.El
147.Sh SEE ALSO
148.Xr crash 8 ,
149.Xr halt 8 ,
150.Xr init 8 ,
151.Xr reboot 8 ,
152.Xr savecore 8
153.Sh HISTORY
154The
155.Fn reboot
156function call appeared in
157.Bx 4.0 .
158