1.\" $NetBSD: reboot.2,v 1.13 2002/02/08 01:28:21 ross 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 June 4, 1993 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.Fd #include \*[Lt]unistd.h\*[Gt] 46.Fd #include \*[Lt]sys/reboot.h\*[Gt] 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_INITNAME 89An option allowing the specification of an init program (see 90.Xr init 8 ) 91other than 92.Pa /sbin/init 93to be run when the system reboots. 94This switch is not currently available. 95.It Dv RB_KDB 96Load the symbol table and enable a built-in debugger in the system. 97This option will have no useful function if the kernel is not configured 98for debugging. 99Several other options have different meaning if combined 100with this option, although their use may not be possible 101via the 102.Fn reboot 103call. 104See 105.Xr ddb 4 106for more information. 107.It Dv RB_NOSYNC 108Normally, the disks are sync'd (see 109.Xr sync 8 ) 110before the processor is halted or rebooted. 111This option may be useful if file system changes have been made manually 112or if the processor is on fire. 113.It Dv RB_RDONLY 114Initially mount the root file system read-only. 115This is currently the default, and this option has been deprecated. 116.It Dv RB_SINGLE 117Normally, the reboot procedure involves an automatic disk consistency 118check and then multi-user operations. 119.Dv RB_SINGLE 120prevents this, booting the system with a single-user shell 121on the console. 122.Dv RB_SINGLE 123is actually interpreted by the 124.Xr init 8 125program in the newly booted system. 126.Pp 127When no options are given (i.e., 128.Dv RB_AUTOBOOT 129is used), the system is 130rebooted from file ``netbsd'' in the root file system of unit 0 131of a disk chosen in a processor specific way. 132An automatic consistency check of the disks is normally performed 133(see 134.Xr fsck 8 ) . 135.It Dv RB_STRING 136.Fa bootstr 137is a string passed to the firmware on the machine, if possible, if this 138option is set. Currently this only implemented on the sparc and the sun3. 139.El 140.Sh RETURN VALUES 141If successful, this call never returns. 142Otherwise, a -1 is returned and an error is returned in the global 143variable 144.Va errno . 145.Sh ERRORS 146.Bl -tag -width Er 147.It Bq Er EPERM 148The caller is not the super-user. 149.El 150.Sh SEE ALSO 151.Xr ddb 4 , 152.Xr crash 8 , 153.Xr halt 8 , 154.Xr init 8 , 155.Xr reboot 8 , 156.Xr savecore 8 157.Sh HISTORY 158The 159.Fn reboot 160function call appeared in 161.Bx 4.0 . 162