xref: /dragonfly/lib/libc/sys/reboot.2 (revision 0dace59e)
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.\" $DragonFly: src/lib/libc/sys/reboot.2,v 1.4 2006/05/26 19:39:37 swildner Exp $
31.\"
32.Dd June 4, 1993
33.Dt REBOOT 2
34.Os
35.Sh NAME
36.Nm reboot
37.Nd reboot system or halt processor
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In unistd.h
42.In sys/reboot.h
43.Ft int
44.Fn reboot "int howto"
45.Sh DESCRIPTION
46.Fn Reboot
47reboots the system.
48Only the super-user may reboot a machine on demand.
49However, a reboot is invoked
50automatically in the event of unrecoverable system failures.
51.Pp
52.Fa Howto
53is a mask of options; the system call interface allows the following
54options, defined in the include file
55.In sys/reboot.h ,
56to be passed
57to the new kernel or the new bootstrap and init programs.
58.Bl -tag -width RB_INITNAMEA
59.It Dv RB_AUTOBOOT
60The default, causing the system to reboot in its usual fashion.
61.It Dv RB_ASKNAME
62Interpreted by the bootstrap program itself, causing it to
63prompt on the console as to what file should be booted.
64Normally, the system is booted from the file
65.Dq Em xx Ns No (0,0)kernel ,
66where
67.Em xx
68is the default disk name,
69without prompting for the file name.
70.It Dv RB_DFLTROOT
71Use the compiled in root device.
72Normally, the system uses the device from which it was booted
73as the root device if possible.
74(The default behavior is dependent on the ability of the bootstrap program
75to determine the drive from which it was loaded, which is not possible
76on all systems.)
77.It Dv RB_DUMP
78Dump kernel memory before rebooting; see
79.Xr savecore 8
80for more information.
81.It Dv RB_HALT
82the processor is simply halted; no reboot takes place.
83This option should be used with caution.
84.It Dv RB_POWEROFF
85After halting, the shutdown code will do what it can to turn
86off the power.
87This requires hardware support.
88.It Dv RB_INITNAME
89An option allowing the specification of an init program (see
90.Xr init 8 )
91other than
92.Pa /sbin/init
93to be run when the system reboots.
94This switch is not currently available.
95.It Dv RB_KDB
96Load the symbol table and enable a built-in debugger in the system.
97This option will have no useful function if the kernel is not configured
98for debugging.
99Several other options have different meaning if combined
100with this option, although their use may not be possible
101via the
102.Fn reboot
103call.
104See
105.Xr ddb 4
106for more information.
107.It Dv RB_NOSYNC
108Normally, the disks are sync'd (see
109.Xr sync 8 )
110before the processor is halted or rebooted.
111This option may be useful if file system changes have been made manually
112or if the processor is on fire.
113.It Dv RB_RDONLY
114Initially mount the root file system read-only.
115This is currently the default, and this option has been deprecated.
116.It Dv RB_SINGLE
117Normally, the reboot procedure involves an automatic disk consistency
118check and then multi-user operations.
119.Dv RB_SINGLE
120prevents this, booting the system with a single-user shell
121on the console.
122.Dv RB_SINGLE
123is actually interpreted by the
124.Xr init 8
125program in the newly booted system.
126.El
127.Pp
128When no options are given (i.e.,
129.Dv RB_AUTOBOOT
130is used), the system is
131rebooted from file
132.Dq kernel
133in the root file system of unit 0
134of a disk chosen in a processor specific way.
135An automatic consistency check of the disks is normally performed
136(see
137.Xr fsck 8 ) .
138.Sh RETURN VALUES
139If successful, this call never returns.
140Otherwise, a -1 is returned and an error is returned in the global
141variable
142.Va errno .
143.Sh ERRORS
144.Bl -tag -width Er
145.It Bq Er EPERM
146The caller is not the super-user.
147.El
148.Sh SEE ALSO
149.Xr crash 8 ,
150.Xr halt 8 ,
151.Xr init 8 ,
152.Xr reboot 8 ,
153.Xr savecore 8
154.Sh HISTORY
155The
156.Fn reboot
157function call appeared in
158.Bx 4.0 .
159.Sh BUGS
160The HP300 implementation supports neither
161.Dv RB_DFLTROOT
162nor
163.Dv RB_KDB .
164