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