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 2004-05-27 "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 " flag ", 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 " flag );
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 .BR LINUX_REBOOT_MAGIC1
63 (that is, 0xfee1dead) and
66 .BR LINUX_REBOOT_MAGIC2
68 However, since 2.1.17 also
69 .BR LINUX_REBOOT_MAGIC2A
72 .BR LINUX_REBOOT_MAGIC2B
75 .BR 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_RESTART
85 (RB_AUTOBOOT, 0x1234567).
86 The message `Restarting system.' is printed, and a default
87 restart is performed immediately.
92 .B LINUX_REBOOT_CMD_HALT
93 (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76).
94 The message `System halted.' is printed, and the system is halted.
95 Control is given to the ROM monitor, if there is one.
100 .B LINUX_REBOOT_CMD_POWER_OFF
101 (0x4321fedc; since 2.1.30).
102 The message `Power down.' is printed, the system is stopped,
103 and all power is removed from the system, if possible.
108 .B LINUX_REBOOT_CMD_RESTART2
109 (0xa1b2c3d4; since 2.1.30).
110 The message `Restarting system with command '%s'' is printed,
111 and a restart (using the command string given in
113 is performed immediately.
118 .B LINUX_REBOOT_CMD_CAD_ON
119 (RB_ENABLE_CAD, 0x89abcdef).
121 This means that the CAD keystroke will immediately cause
122 the action associated with
123 .BR LINUX_REBOOT_CMD_RESTART .
125 .B LINUX_REBOOT_CMD_CAD_OFF
128 This means that the CAD keystroke will cause a
131 sent to init (process 1), whereupon this process may decide upon a
132 proper action (maybe: kill all processes, sync, reboot).
134 Only the superuser may use this function.
136 The precise effect of the above actions depends on the architecture.
137 For the i386 architecture, the additional argument does not do
138 anything at present (2.1.122), but the type of reboot can be
139 determined by kernel command line arguments (`reboot=...') to be
140 either warm or cold, and either hard or through the BIOS.
142 On success, zero is returned.
143 On error, \-1 is returned, and
145 is set appropriately.
149 Problem with getting userspace data under
150 .BR LINUX_REBOOT_CMD_RESTART2 .
153 Bad magic numbers or \fIflag\fP.
156 The calling process has insufficient privilege to call
160 capability is required.
164 and should not be used in programs intended to be portable.
168 .BR capabilities (7),