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