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@gmx.net>
23 .\" Added notes on capability requirements
25 .TH REBOOT 2 2004-05-27 "Linux 2.6.6" "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 are identical,
30 and since kernel version 2.1.30 there are symbolic names
31 LINUX_REBOOT_* for the constants and a fourth argument to the call:
33 .B #include <unistd.h>
35 .B #include <linux/reboot.h>
37 .BI "int reboot(int " magic ", int " magic2 ", int " flag ", void *" arg );
39 Under glibc some of the constants involved have gotten symbolic names RB_*,
40 and the library call is a 1-argument wrapper around the 3-argument
43 .B #include <unistd.h>
45 .B #include <sys/reboot.h>
47 .BI "int reboot(int " flag );
51 call reboots the system, or enables/disables the reboot keystroke
52 (abbreviated CAD, since the default is Ctrl-Alt-Delete;
53 it can be changed using
56 This system call will fail (with EINVAL) unless
58 equals LINUX_REBOOT_MAGIC1 (that is, 0xfee1dead) and
60 equals LINUX_REBOOT_MAGIC2 (that is, 672274793).
61 However, since 2.1.17 also LINUX_REBOOT_MAGIC2A (that is, 85072278)
62 and since 2.1.97 also LINUX_REBOOT_MAGIC2B (that is, 369367448)
63 and since 2.5.71 also LINUX_REBOOT_MAGIC2C (that is, 537993216)
64 are permitted as value for
66 (The hexadecimal values of these constants are meaningful.)
69 argument can have the following values:
71 .B LINUX_REBOOT_CMD_RESTART
72 (RB_AUTOBOOT, 0x1234567).
73 The message `Restarting system.' is printed, and a default
74 restart is performed immediately.
79 .B LINUX_REBOOT_CMD_HALT
80 (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76).
81 The message `System halted.' is printed, and the system is halted.
82 Control is given to the ROM monitor, if there is one.
87 .B LINUX_REBOOT_CMD_POWER_OFF
88 (0x4321fedc; since 2.1.30).
89 The message `Power down.' is printed, the system is stopped,
90 and all power is removed from the system, if possible.
95 .B LINUX_REBOOT_CMD_RESTART2
96 (0xa1b2c3d4; since 2.1.30).
97 The message `Restarting system with command '%s'' is printed,
98 and a restart (using the command string given in
100 is performed immediately.
105 .B LINUX_REBOOT_CMD_CAD_ON
106 (RB_ENABLE_CAD, 0x89abcdef).
108 This means that the CAD keystroke will immediately cause
109 the action associated to LINUX_REBOOT_CMD_RESTART.
111 .B LINUX_REBOOT_CMD_CAD_OFF
114 This means that the CAD keystroke will cause a SIGINT signal to be
115 sent to init (process 1), whereupon this process may decide upon a
116 proper action (maybe: kill all processes, sync, reboot).
118 Only the superuser may use this function.
120 The precise effect of the above actions depends on the architecture.
121 For the i386 architecture, the additional argument does not do
122 anything at present (2.1.122), but the type of reboot can be
123 determined by kernel command line arguments (`reboot=...') to be
124 either warm or cold, and either hard or through the BIOS.
126 On success, zero is returned. On error, \-1 is returned, and
128 is set appropriately.
132 Problem with getting userspace data under LINUX_REBOOT_CMD_RESTART2.
135 Bad magic numbers or \fIflag\fP.
138 The calling process has insufficient privilege to call
142 capability is required.
145 is Linux specific, and should not be used in programs intended to be portable.
149 .BR capabilities (7),