1 .\" Copyright (c) 1998 Andries Brouwer (aeb@cwi.nl), 24 September 1998
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
26 .\" Added notes on capability requirements
28 .TH REBOOT 2 2010-10-31 "Linux" "Linux Programmer's Manual"
30 reboot \- reboot or enable/disable Ctrl-Alt-Del
32 /* For libc4 and libc5 the library call and the system call
33 are identical, and since kernel version 2.1.30 there are
34 symbolic names LINUX_REBOOT_* for the constants and a
35 fourth argument to the call: */
37 .B #include <unistd.h>
39 .B #include <linux/reboot.h>
41 .BI "int reboot(int " magic ", int " magic2 ", int " cmd ", void *" arg );
43 /* Under glibc some of the constants involved have gotten
44 symbolic names RB_*, and the library call is a 1-argument
45 wrapper around the 3-argument system call: */
47 .B #include <unistd.h>
49 .B #include <sys/reboot.h>
51 .BI "int reboot(int " cmd );
55 call reboots the system, or enables/disables the reboot keystroke
56 (abbreviated CAD, since the default is Ctrl-Alt-Delete;
57 it can be changed using
60 This system call will fail (with
65 .B LINUX_REBOOT_MAGIC1
66 (that is, 0xfee1dead) and
69 .B LINUX_REBOOT_MAGIC2
71 However, since 2.1.17 also
72 .B LINUX_REBOOT_MAGIC2A
75 .B LINUX_REBOOT_MAGIC2B
78 .B LINUX_REBOOT_MAGIC2C
80 are permitted as value for
82 (The hexadecimal values of these constants are meaningful.)
85 argument can have the following values:
87 .B LINUX_REBOOT_CMD_CAD_OFF
90 This means that the CAD keystroke will cause a
93 sent to init (process 1), whereupon this process may decide upon a
94 proper action (maybe: kill all processes, sync, reboot).
96 .B LINUX_REBOOT_CMD_CAD_ON
97 (RB_ENABLE_CAD, 0x89abcdef).
99 This means that the CAD keystroke will immediately cause
100 the action associated with
101 .BR LINUX_REBOOT_CMD_RESTART .
103 .B LINUX_REBOOT_CMD_HALT
104 (RB_HALT_SYSTEM, 0xcdef0123; since Linux 1.1.76).
105 The message "System halted." is printed, and the system is halted.
106 Control is given to the ROM monitor, if there is one.
111 .BR LINUX_REBOOT_CMD_KEXEC
112 (RB_KEXEC, 0x45584543, since Linux Linux 2.6.13)
113 Execute a kernel that has been loaded earlier with
115 This option is available only if the kernel was configured with
118 .B LINUX_REBOOT_CMD_POWER_OFF
119 (RB_POWER_OFF, 0x4321fedc; since Linux 2.1.30).
120 The message "Power down." is printed, the system is stopped,
121 and all power is removed from the system, if possible.
126 .B LINUX_REBOOT_CMD_RESTART
127 (RB_AUTOBOOT, 0x1234567).
128 The message "Restarting system." is printed, and a default
129 restart is performed immediately.
134 .B LINUX_REBOOT_CMD_RESTART2
135 (0xa1b2c3d4; since Linux 2.1.30).
136 The message "Restarting system with command \(aq%s\(aq" is printed,
137 and a restart (using the command string given in
139 is performed immediately.
144 .BR LINUX_REBOOT_CMD_SW_SUSPEND
145 (0xd000fce2; since Linux 2.5.18).
146 The system is suspended (hibernated) to disk.
147 This option is available only if the kernel was configured with
148 .BR CONFIG_HIBERNATION .
150 Only the superuser may call
153 The precise effect of the above actions depends on the architecture.
154 For the i386 architecture, the additional argument does not do
155 anything at present (2.1.122), but the type of reboot can be
156 determined by kernel command-line arguments ("reboot=...") to be
157 either warm or cold, and either hard or through the BIOS.
161 that stop or restart the system,
167 values, zero is returned on success.
168 In all cases, \-1 is returned on failure, and
170 is set appropriately.
174 Problem with getting user-space data under
175 .BR LINUX_REBOOT_CMD_RESTART2 .
178 Bad magic numbers or \fIcmd\fP.
181 The calling process has insufficient privilege to call
185 capability is required.
189 and should not be used in programs intended to be portable.
193 .BR capabilities (7),