1.\" Copyright (c) 1980, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)reboot.2 6.5 (Berkeley) 3/10/91 33.\" $Id: reboot.2,v 1.4 1994/09/17 00:17:43 mycroft Exp $ 34.\" 35.Dd March 10, 1991 36.Dt REBOOT 2 37.Os BSD 4 38.Sh NAME 39.Nm reboot 40.Nd reboot system or halt processor 41.Sh SYNOPSIS 42.Fd #include <unistd.h> 43.Fd #include <sys/reboot.h> 44.Ft int 45.Fn reboot "int howto" 46.Sh DESCRIPTION 47.Fn Reboot 48reboots the system. 49Only the super-user may reboot a machine on demand. 50However, a reboot is invoked 51automatically in the event of unrecoverable system failures. 52.Pp 53.Fa Howto 54is a mask of options; the system call interface allows the following 55options, defined in the include file 56.Aq Pa sys/reboot.h , 57to be passed 58to the new kernel or the new bootstrap and init programs. 59.Bl -tag -width RB_INITNAMEA 60.It Dv RB_AUTOBOOT 61The default, causing the system to reboot in its usual fashion. 62.It Dv RB_ASKNAME 63Interpreted by the bootstrap program itself, causing it to 64prompt on the console as to what file should be booted. 65Normally, the system is booted from the file 66.Dq Em xx Ns No (0,0)netbsd , 67where 68.Em xx 69is the default disk name, 70without prompting for the file name. 71.It Dv RB_DFLTROOT 72Use the compiled in root device. 73Normally, the system uses the device from which it was booted 74as the root device if possible. 75(The default behavior is dependent on the ability of the bootstrap program 76to determine the drive from which it was loaded, which is not possible 77on all systems.) 78.It Dv RB_DUMP 79Dump kernel memory before rebooting; see 80.Xr savecore 8 81for more information. 82.It Dv RB_HALT 83the processor is simply halted; no reboot takes place. 84This option should be used with caution. 85.It Dv RB_INITNAME 86An option allowing the specification of an init program (see 87.Xr init 8 ) 88other than 89.Pa /sbin/init 90to be run when the system reboots. 91This switch is not currently available. 92.It Dv RB_KDB 93Load the symbol table and enable a built-in debugger in the system. 94This option will have no useful function if the kernel is not configured 95for debugging. 96Several other options have different meaning if combined 97with this option, although their use may not be possible 98via the 99.Fn reboot 100call. 101See 102.Xr kadb 4 103for more information. 104.It Dv RB_NOSYNC 105Normally, the disks are sync'd (see 106.Xr sync 8 ) 107before the processor is halted or rebooted. 108This option may be useful if file system changes have been made manually 109or if the processor is on fire. 110.It Dv RB_RDONLY 111Initially mount the root file system read-only. 112This is currently the default, and this option has been deprecated. 113.It Dv RB_SINGLE 114Normally, the reboot procedure involves an automatic disk consistency 115check and then multi-user operations. 116.Dv RB_SINGLE 117prevents this, booting the system with a single-user shell 118on the console. 119.Dv RB_SINGLE 120is actually interpreted by the 121.Xr init 8 122program in the newly booted system. 123.Pp 124When no options are given (i.e., 125.Dv RB_AUTOBOOT 126is used), the system is 127rebooted from file ``netbsd'' in the root file system of unit 0 128of a disk chosen in a processor specific way. 129An automatic consistency check of the disks is normally performed 130(see 131.Xr fsck 8 ) . 132.El 133.Sh RETURN VALUES 134If successful, this call never returns. 135Otherwise, a -1 is returned and an error is returned in the global 136variable 137.Va errno . 138.Sh ERRORS 139.Bl -tag -width Er 140.It Bq Er EPERM 141The caller is not the super-user. 142.El 143.Sh SEE ALSO 144.Xr kadb 4 , 145.Xr crash 8 , 146.Xr halt 8 , 147.Xr init 8 , 148.Xr reboot 8 , 149.Xr savecore 8 150.Sh BUGS 151The HP300 implementation supports neither 152.Dv RB_DFLTROOT 153nor 154.Dv RB_KDB . 155.Sh HISTORY 156The 157.Fn reboot 158function call appeared in 159.Bx 4.0 . 160