1.\" $NetBSD: reboot.2,v 1.20 2004/05/13 10:20:58 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 18, 2002 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 -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)netbsd , 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_POWERDOWN 85If used in conjunction with 86.Dv RB_HALT , 87and if the system hardware supports the function, the system will be 88powered off. 89.It Dv RB_INITNAME 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 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 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 115Initially mount the root file system read-only. 116This is currently the default, and this option has been deprecated. 117.It Dv RB_SINGLE 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 137.Fa bootstr 138is a string passed to the firmware on the machine, if possible, if this 139option is set. 140Currently this only implemented on the sparc and the sun3. 141.El 142.Sh RETURN VALUES 143If successful, this call never returns. 144Otherwise, a \-1 is returned and an error is returned in the global 145variable 146.Va errno . 147.Sh ERRORS 148.Bl -tag -width Er 149.It Bq Er EPERM 150The caller is not the super-user. 151.El 152.Sh SEE ALSO 153.Xr ddb 4 , 154.Xr crash 8 , 155.Xr halt 8 , 156.Xr init 8 , 157.Xr reboot 8 , 158.Xr savecore 8 159.Sh HISTORY 160The 161.Fn reboot 162function call appeared in 163.Bx 4.0 . 164