1 .\" Copyright (c) 1998 Andries Brouwer (aeb@cwi.nl), 24 September 1998
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
23 .\" Added notes on capability requirements
25 .TH REBOOT 2 2010-10-31 "Linux" "Linux Programmer's Manual"
27 reboot \- reboot or enable/disable Ctrl-Alt-Del
29 /* For libc4 and libc5 the library call and the system call
30 are identical, and since kernel version 2.1.30 there are
31 symbolic names LINUX_REBOOT_* for the constants and a
32 fourth argument to the call: */
34 .B #include <unistd.h>
36 .B #include <linux/reboot.h>
38 .BI "int reboot(int " magic ", int " magic2 ", int " cmd ", void *" arg );
40 /* Under glibc some of the constants involved have gotten
41 symbolic names RB_*, and the library call is a 1-argument
42 wrapper around the 3-argument system call: */
44 .B #include <unistd.h>
46 .B #include <sys/reboot.h>
48 .BI "int reboot(int " cmd );
52 call reboots the system, or enables/disables the reboot keystroke
53 (abbreviated CAD, since the default is Ctrl-Alt-Delete;
54 it can be changed using
57 This system call will fail (with
62 .B LINUX_REBOOT_MAGIC1
63 (that is, 0xfee1dead) and
66 .B LINUX_REBOOT_MAGIC2
68 However, since 2.1.17 also
69 .B LINUX_REBOOT_MAGIC2A
72 .B LINUX_REBOOT_MAGIC2B
75 .B LINUX_REBOOT_MAGIC2C
77 are permitted as value for
79 (The hexadecimal values of these constants are meaningful.)
82 argument can have the following values:
84 .B LINUX_REBOOT_CMD_CAD_OFF
87 This means that the CAD keystroke will cause a
90 sent to init (process 1), whereupon this process may decide upon a
91 proper action (maybe: kill all processes, sync, reboot).
93 .B LINUX_REBOOT_CMD_CAD_ON
94 (RB_ENABLE_CAD, 0x89abcdef).
96 This means that the CAD keystroke will immediately cause
97 the action associated with
98 .BR LINUX_REBOOT_CMD_RESTART .
100 .B LINUX_REBOOT_CMD_HALT
101 (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76).
102 The message "System halted." is printed, and the system is halted.
103 Control is given to the ROM monitor, if there is one.
108 .BR LINUX_REBOOT_CMD_KEXEC " (since Linux 2.6.13)"
109 Execute a kernel that has been loaded earlier with
111 This option is only available if the kernel was configured with
114 .B LINUX_REBOOT_CMD_POWER_OFF
115 (0x4321fedc; since 2.1.30).
116 The message "Power down." is printed, the system is stopped,
117 and all power is removed from the system, if possible.
122 .B LINUX_REBOOT_CMD_RESTART
123 (RB_AUTOBOOT, 0x1234567).
124 The message "Restarting system." is printed, and a default
125 restart is performed immediately.
130 .B LINUX_REBOOT_CMD_RESTART2
131 (0xa1b2c3d4; since 2.1.30).
132 The message "Restarting system with command \(aq%s\(aq" is printed,
133 and a restart (using the command string given in
135 is performed immediately.
140 Only the superuser may call
143 The precise effect of the above actions depends on the architecture.
144 For the i386 architecture, the additional argument does not do
145 anything at present (2.1.122), but the type of reboot can be
146 determined by kernel command-line arguments ("reboot=...") to be
147 either warm or cold, and either hard or through the BIOS.
151 that stop or restart the system,
157 values, zero is returned on success.
158 In all cases, \-1 is returned on failure, and
160 is set appropriately.
164 Problem with getting userspace data under
165 .BR LINUX_REBOOT_CMD_RESTART2 .
168 Bad magic numbers or \fIcmd\fP.
171 The calling process has insufficient privilege to call
175 capability is required.
179 and should not be used in programs intended to be portable.
183 .BR capabilities (7),