1.\" $OpenBSD: reboot.2,v 1.19 2017/04/15 18:55:27 guenther Exp $ 2.\" $NetBSD: reboot.2,v 1.5 1995/02/27 12:36:02 cgd Exp $ 3.\" 4.\" Copyright (c) 1980, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 32.\" 33.Dd $Mdocdate: April 15 2017 $ 34.Dt REBOOT 2 35.Os 36.Sh NAME 37.Nm reboot 38.Nd reboot system or halt processor 39.Sh SYNOPSIS 40.In unistd.h 41.In sys/reboot.h 42.Ft int 43.Fn reboot "int howto" 44.Sh DESCRIPTION 45.Fn reboot 46reboots the system. 47Only the superuser may reboot a machine on demand. 48However, a reboot is invoked 49automatically in the event of unrecoverable system failures. 50.Pp 51.Fa howto 52is a mask of options; the system call interface allows the following 53options, defined in the include file 54.In sys/reboot.h , 55to be passed 56to the new kernel or the new bootstrap and init programs. 57.Bl -tag -width RB_INITNAMEA 58.It Dv RB_AUTOBOOT 59The default, causing the system to reboot in its usual fashion. 60.It Dv RB_ASKNAME 61Interpreted by the bootstrap program itself, causing it to 62prompt on the console as to what file should be booted. 63Normally, the system is booted from the file 64.Dq Em xx Ns (0,0)bsd , 65where 66.Em xx 67is the default disk name, 68without prompting for the file name. 69.It Dv RB_DUMP 70Dump kernel memory before rebooting; see 71.Xr savecore 8 72for more information. 73.It Dv RB_HALT 74The processor is simply halted; no reboot takes place. 75.It Dv RB_POWERDOWN 76If used in conjunction with 77.Dv RB_HALT , 78and if the system hardware supports the function, the system will be 79powered off. 80.It Dv RB_USERREQ 81By default, the system will halt if 82.Fn reboot 83is called during startup (before the system has finished autoconfiguration), 84even if 85.Dv RB_HALT 86is not specified. 87This is because 88.Xr panic 9 Ns s 89during startup will probably just repeat on the next boot. 90Use of this option implies that the user has requested the action 91specified (for example, using the 92.Xr ddb 4 93.Ic boot reboot 94command), 95so the system will reboot if a halt is not explicitly requested. 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 via 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_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 128.Pa /bsd 129in the root file system of unit 0 130of a disk chosen in a processor specific way. 131An automatic consistency check of the disks is normally performed 132(see 133.Xr fsck 8 ) . 134.It Dv RB_TIMEBAD 135Don't update the hardware clock from the system clock, 136presumably because the system clock is suspect. 137.El 138.Sh RETURN VALUES 139If successful, this call never returns. 140Otherwise, a \-1 is returned and an error is returned in the global 141variable 142.Va errno . 143.Sh ERRORS 144.Bl -tag -width Er 145.It Bq Er EPERM 146The caller is not the superuser. 147.El 148.Sh SEE ALSO 149.Xr ddb 4 , 150.Xr crash 8 , 151.Xr halt 8 , 152.Xr init 8 , 153.Xr reboot 8 , 154.Xr savecore 8 , 155.Xr boot 9 , 156.Xr panic 9 157.Sh HISTORY 158The 159.Fn reboot 160system call finally appeared in 161.Bx 4.0 . 162.Sh BUGS 163Not all platforms support all possible arguments. 164