xref: /netbsd-src/lib/libc/sys/reboot.2 (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1.\"	$NetBSD: reboot.2,v 1.23 2006/08/05 18:18:37 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. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)reboot.2	8.1 (Berkeley) 6/4/93
31.\"
32.Dd August 5, 2006
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" "char *bootstr"
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.Aq Pa sys/reboot.h ,
56to be passed
57to the new kernel or the new bootstrap and init programs.
58.Bl -column RB_INITNAMEA 0x0000
59.It Dv RB_AUTOBOOT Ta Li 0x0000 Ta
60The default, causing the system to reboot in its usual fashion.
61.It Dv RB_ASKNAME Ta Li 0x0001 Ta
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)netbsd ,
66where
67.Em xx
68is the default disk name,
69without prompting for the file name.
70.It Dv RB_DFLTROOT Ta Li 0x0020 Ta
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 Ta Li 0x0100 Ta
78Dump kernel memory before rebooting; see
79.Xr savecore 8
80for more information.
81.It Dv RB_HALT Ta Li 0x0008 Ta
82the processor is simply halted; no reboot takes place.
83This option should be used with caution.
84.It Dv RB_POWERDOWN Ta Li 0x0808 Ta
85This option is always used in conjunction with
86.Dv RB_HALT ,
87and if the system hardware supports the function, the system will be
88powered off, otherwise it has no effect.
89.It Dv RB_INITNAME Ta Li 0x0010 Ta
90An option allowing the specification of an init program (see
91.Xr init 8 )
92other than
93.Pa /sbin/init
94to be run when the system reboots.
95This switch is not currently available.
96.It Dv RB_KDB Ta Li 0x0040 Ta
97Load the symbol table and enable a built-in debugger in the system.
98This option will have no useful function if the kernel is not configured
99for debugging.
100Several other options have different meaning if combined
101with this option, although their use may not be possible
102via the
103.Fn reboot
104call.
105See
106.Xr ddb 4
107for more information.
108.It Dv RB_NOSYNC Ta Li 0x0004 Ta
109Normally, the disks are sync'd (see
110.Xr sync 8 )
111before the processor is halted or rebooted.
112This option may be useful if file system changes have been made manually
113or if the processor is on fire.
114.It Dv RB_RDONLY Ta Li 0x0080 Ta
115Initially mount the root file system read-only.
116This is currently the default, and this option has been deprecated.
117.It Dv RB_SINGLE Ta Li 0x0002 Ta
118Normally, the reboot procedure involves an automatic disk consistency
119check and then multi-user operations.
120.Dv RB_SINGLE
121prevents this, booting the system with a single-user shell
122on the console.
123.Dv RB_SINGLE
124is actually interpreted by the
125.Xr init 8
126program in the newly booted system.
127.Pp
128When no options are given (i.e.,
129.Dv RB_AUTOBOOT
130is used), the system is
131rebooted from file ``netbsd'' in the root file system of unit 0
132of a disk chosen in a processor specific way.
133An automatic consistency check of the disks is normally performed
134(see
135.Xr fsck 8 ) .
136.It Dv RB_STRING Ta Li 0x0400 Ta
137.Fa bootstr
138is a string passed to the firmware on the machine, if possible, if this
139option is set.
140Currently this is only implemented on the sparc and the sun3 ports.
141.It Dv RB_USERCONF Ta Li 0x1000 Ta
142Initially invoke the
143.Xr userconf 4
144facility when the system starts up again, if it has been compiled into
145the kernel that is loaded.
146.El
147.Sh RETURN VALUES
148If successful, this call never returns.
149Otherwise, a \-1 is returned and an error is returned in the global
150variable
151.Va errno .
152.Sh ERRORS
153.Bl -tag -width Er
154.It Bq Er EPERM
155The caller is not the super-user.
156.El
157.Sh SEE ALSO
158.Xr ddb 4 ,
159.Xr crash 8 ,
160.Xr halt 8 ,
161.Xr init 8 ,
162.Xr reboot 8 ,
163.Xr savecore 8
164.Sh HISTORY
165The
166.Fn reboot
167function call appeared in
168.Bx 4.0 .
169.Pp
170The
171.Dv RB_DFLTROOT
172option is now
173.Em obsolete .
174