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