1.\" $NetBSD: reboot.2,v 1.26 2008/11/06 16:23:56 tsutsui 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 September 11, 2008 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. 58Options can be combined together by OR'ing them, eg. 59.Dv RB_DUMP | 60.Dv RB_NOSYNC 61would be interpreted as 62.Dq dump kernel memory before rebooting and don't sync the disks . 63.Bl -column RB_INITNAMEA 0x0000 64.It Dv RB_AUTOBOOT Ta Li 0x0000 Ta 65The default, causing the system to reboot in its usual fashion. 66.It Dv RB_ASKNAME Ta Li 0x0001 Ta 67Interpreted by the bootstrap program itself, causing it to 68prompt on the console as to what file should be booted. 69Normally, the system is booted from the file 70.Dq Em xx Ns No (0,0)netbsd , 71where 72.Em xx 73is the default disk name, 74without prompting for the file name. 75.\" Obsolete! 76.\" .It Dv RB_DFLTROOT Ta Li 0x0020 Ta 77.\" Use the compiled in root device. 78.\" Normally, the system uses the device from which it was booted 79.\" as the root device if possible. 80.\" (The default behavior is dependent on the ability of the bootstrap program 81.\" to determine the drive from which it was loaded, which is not possible 82.\" on all systems.) 83.It Dv RB_DUMP Ta Li 0x0100 Ta 84Dump kernel memory before rebooting; see 85.Xr savecore 8 86for more information. 87.It Dv RB_HALT Ta Li 0x0008 Ta 88the processor is simply halted; no reboot takes place. 89This option should be used with caution. 90.It Dv RB_POWERDOWN Ta Li 0x0808 Ta 91This option is always used in conjunction with 92.Dv RB_HALT , 93and if the system hardware supports the function, the system will be 94powered off, otherwise it has no effect. 95.It Dv RB_INITNAME Ta Li 0x0010 Ta 96An option allowing the specification of an init program (see 97.Xr init 8 ) 98other than 99.Pa /sbin/init 100to be run when the system reboots. 101This switch is not currently available. 102.It Dv RB_KDB Ta Li 0x0040 Ta 103Load the symbol table and enable a built-in debugger in the system. 104This option will have no useful function if the kernel is not configured 105for debugging. 106Several other options have different meaning if combined 107with this option, although their use may not be possible 108via the 109.Fn reboot 110call. 111See 112.Xr ddb 4 113for more information. 114.It Dv RB_NOSYNC Ta Li 0x0004 Ta 115Normally, the disks are sync'd (see 116.Xr sync 8 ) 117before the processor is halted or rebooted. 118This option may be useful if file system changes have been made manually 119or if the processor is on fire. 120.It Dv RB_RDONLY Ta Li 0x0080 Ta 121Initially mount the root file system read-only. 122This is currently the default, and this option has been deprecated. 123.It Dv RB_SINGLE Ta Li 0x0002 Ta 124Normally, the reboot procedure involves an automatic disk consistency 125check and then multi-user operations. 126.Dv RB_SINGLE 127prevents this, booting the system with a single-user shell 128on the console. 129.Dv RB_SINGLE 130is actually interpreted by the 131.Xr init 8 132program in the newly booted system. 133.Pp 134When no options are given (i.e., 135.Dv RB_AUTOBOOT 136is used), the system is 137rebooted from file ``netbsd'' in the root file system of unit 0 138of a disk chosen in a processor specific way. 139An automatic consistency check of the disks is normally performed 140(see 141.Xr fsck 8 ) . 142.It Dv RB_STRING Ta Li 0x0400 Ta 143.Fa bootstr 144is a string passed to the firmware on the machine, if possible, if this 145option is set. 146Currently this is only implemented on the sparc and the sun3 ports. 147.It Dv RB_USERCONF Ta Li 0x1000 Ta 148Initially invoke the 149.Xr userconf 4 150facility when the system starts up again, if it has been compiled into 151the kernel that is loaded. 152.El 153.Sh RETURN VALUES 154If successful, this call never returns. 155Otherwise, a \-1 is returned and an error is returned in the global 156variable 157.Va errno . 158.Sh ERRORS 159.Bl -tag -width Er 160.It Bq Er EPERM 161The caller is not the super-user. 162.El 163.Sh SEE ALSO 164.Xr ddb 4 , 165.\" .Xr crash 8 , 166.Xr halt 8 , 167.Xr init 8 , 168.Xr reboot 8 , 169.Xr savecore 8 170.Sh HISTORY 171The 172.Fn reboot 173function call appeared in 174.Bx 4.0 . 175.Pp 176The 177.Dv RB_DFLTROOT 178option is now 179.Em obsolete . 180