xref: /openbsd-src/lib/libc/sys/reboot.2 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"	$OpenBSD: reboot.2,v 1.8 2000/10/18 05:12:11 aaron Exp $
2.\"	$NetBSD: reboot.2,v 1.5 1995/02/27 12:36:02 cgd Exp $
3.\"
4.\" Copyright (c) 1980, 1991, 1993
5.\"	The Regents of the University of California.  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 the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)reboot.2	8.1 (Berkeley) 6/4/93
36.\"
37.Dd June 4, 1993
38.Dt REBOOT 2
39.Os
40.Sh NAME
41.Nm reboot
42.Nd reboot system or halt processor
43.Sh SYNOPSIS
44.Fd #include <unistd.h>
45.Fd #include <sys/reboot.h>
46.Ft int
47.Fn reboot "int howto"
48.Sh DESCRIPTION
49.Fn reboot
50reboots the system.
51Only the superuser may reboot a machine on demand.
52However, a reboot is invoked
53automatically in the event of unrecoverable system failures.
54.Pp
55.Fa howto
56is a mask of options; the system call interface allows the following
57options, defined in the include file
58.Aq Pa sys/reboot.h ,
59to be passed
60to the new kernel or the new bootstrap and init programs.
61.Bl -tag -width RB_INITNAMEA
62.It Dv RB_AUTOBOOT
63The default, causing the system to reboot in its usual fashion.
64.It Dv RB_ASKNAME
65Interpreted by the bootstrap program itself, causing it to
66prompt on the console as to what file should be booted.
67Normally, the system is booted from the file
68.Dq Em xx Ns No (0,0)bsd ,
69where
70.Em xx
71is the default disk name,
72without prompting for the file name.
73.It Dv RB_DFLTROOT
74Use the compiled in root device.
75Normally, the system uses the device from which it was booted
76as the root device if possible.
77(The default behavior is dependent on the ability of the bootstrap program
78to determine the drive from which it was loaded, which is not possible
79on all systems.)
80.It Dv RB_DUMP
81Dump kernel memory before rebooting; see
82.Xr savecore 8
83for more information.
84.It Dv RB_HALT
85the processor is simply halted; no reboot takes place.
86.It Dv RB_POWERDOWN
87If used in conjunction with
88.Dv RB_HALT ,
89and if the system hardware supports the function, the system will be
90powered off.
91.It Dv RB_INITNAME
92An option allowing the specification of an init program (see
93.Xr init 8 )
94other than
95.Pa /sbin/init
96to be run when the system reboots.
97This switch is not currently available.
98.It Dv RB_KDB
99Load the symbol table and enable a built-in debugger in the system.
100This option will have no useful function if the kernel is not configured
101for debugging.
102Several other options have different meaning if combined
103with this option, although their use may not be possible via the
104.Fn reboot
105call.
106See
107.Xr kadb 4
108for more information.
109.It Dv RB_NOSYNC
110Normally, the disks are sync'd (see
111.Xr sync 8 )
112before the processor is halted or rebooted.
113This option may be useful if file system changes have been made manually
114or if the processor is on fire.
115.It Dv RB_RDONLY
116Initially mount the root file system read-only.
117This is currently the default, and this option has been deprecated.
118.It Dv RB_SINGLE
119Normally, the reboot procedure involves an automatic disk consistency
120check and then multi-user operations.
121.Dv RB_SINGLE
122prevents this, booting the system with a single-user shell
123on the console.
124.Dv RB_SINGLE
125is actually interpreted by the
126.Xr init 8
127program in the newly booted system.
128.Pp
129When no options are given (i.e.,
130.Dv RB_AUTOBOOT
131is used), the system is
132rebooted from file ``bsd'' in 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.El
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 superuser.
147.El
148.Sh SEE ALSO
149.Xr kadb 4 ,
150.Xr crash 8 ,
151.Xr halt 8 ,
152.Xr init 8 ,
153.Xr reboot 8 ,
154.Xr savecore 8
155.Sh HISTORY
156The
157.Fn reboot
158function call appeared in
159.Bx 4.0 .
160.Sh BUGS
161Not all platforms support all possible arguments.
162For example,
163.Dv RB_POWERDOWN
164is supported only on the i386, sparc, and mac68k platforms.
165