xref: /original-bsd/lib/libc/sys/reboot.2 (revision c3e32dec)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)reboot.2	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt REBOOT 2
10.Os BSD 4
11.Sh NAME
12.Nm reboot
13.Nd reboot system or halt processor
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Fd #include <sys/reboot.h>
17.Ft int
18.Fn reboot "int howto"
19.Sh DESCRIPTION
20.Fn Reboot
21reboots the system.
22Only the super-user may reboot a machine on demand.
23However, a reboot is invoked
24automatically in the event of unrecoverable system failures.
25.Pp
26.Fa Howto
27is a mask of options; the system call interface allows the following
28options, defined in the include file
29.Aq Pa sys/reboot.h ,
30to be passed
31to the new kernel or the new bootstrap and init programs.
32.Bl -tag -width RB_INITNAMEA
33.It Dv RB_AUTOBOOT
34The default, causing the system to reboot in its usual fashion.
35.It Dv RB_ASKNAME
36Interpreted by the bootstrap program itself, causing it to
37prompt on the console as to what file should be booted.
38Normally, the system is booted from the file
39.Dq Em xx Ns No (0,0)vmunix ,
40where
41.Em xx
42is the default disk name,
43without prompting for the file name.
44.It Dv RB_DFLTROOT
45Use the compiled in root device.
46Normally, the system uses the device from which it was booted
47as the root device if possible.
48(The default behavior is dependent on the ability of the bootstrap program
49to determine the drive from which it was loaded, which is not possible
50on all systems.)
51.It Dv RB_DUMP
52Dump kernel memory before rebooting; see
53.Xr savecore 8
54for more information.
55.It Dv RB_HALT
56the processor is simply halted; no reboot takes place.
57This option should be used with caution.
58.It Dv RB_INITNAME
59An option allowing the specification of an init program (see
60.Xr init 8 )
61other than
62.Pa /sbin/init
63to be run when the system reboots.
64This switch is not currently available.
65.It Dv RB_KDB
66Load the symbol table and enable a built-in debugger in the system.
67This option will have no useful function if the kernel is not configured
68for debugging.
69Several other options have different meaning if combined
70with this option, although their use may not be possible
71via the
72.Fn reboot
73call.
74See
75.Xr kadb 4
76for more information.
77.It Dv RB_NOSYNC
78Normally, the disks are sync'd (see
79.Xr sync 8 )
80before the processor is halted or rebooted.
81This option may be useful if file system changes have been made manually
82or if the processor is on fire.
83.It Dv RB_RDONLY
84Initially mount the root file system read-only.
85This is currently the default, and this option has been deprecated.
86.It Dv RB_SINGLE
87Normally, the reboot procedure involves an automatic disk consistency
88check and then multi-user operations.
89.Dv RB_SINGLE
90prevents this, booting the system with a single-user shell
91on the console.
92.Dv RB_SINGLE
93is actually interpreted by the
94.Xr init 8
95program in the newly booted system.
96.Pp
97When no options are given (i.e.,
98.Dv RB_AUTOBOOT
99is used), the system is
100rebooted from file ``vmunix'' in the root file system of unit 0
101of a disk chosen in a processor specific way.
102An automatic consistency check of the disks is normally performed
103(see
104.Xr fsck 8 ) .
105.El
106.Sh RETURN VALUES
107If successful, this call never returns.
108Otherwise, a -1 is returned and an error is returned in the global
109variable
110.Va errno .
111.Sh ERRORS
112.Bl -tag -width Er
113.It Bq Er EPERM
114The caller is not the super-user.
115.El
116.Sh SEE ALSO
117.Xr kadb 4 ,
118.Xr crash 8 ,
119.Xr halt 8 ,
120.Xr init 8 ,
121.Xr reboot 8 ,
122.Xr savecore 8
123.Sh BUGS
124The HP300 implementation supports neither
125.Dv RB_DFLTROOT
126nor
127.Dv RB_KDB .
128.Sh HISTORY
129The
130.Nm
131function call appeared in
132.Bx 4.0 .
133