]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1998 Andries Brouwer (aeb@cwi.nl), 24 September 1998 |
2 | .\" | |
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. | |
6 | .\" | |
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. | |
c13182ef | 11 | .\" |
fea681da MK |
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 | |
18 | .\" professionally. | |
c13182ef | 19 | .\" |
fea681da MK |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
c11b1abf | 22 | .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da MK |
23 | .\" Added notes on capability requirements |
24 | .\" | |
d9343c5c | 25 | .TH REBOOT 2 2004-05-27 "Linux" "Linux Programmer's Manual" |
fea681da MK |
26 | .SH NAME |
27 | reboot \- reboot or enable/disable Ctrl-Alt-Del | |
28 | .SH SYNOPSIS | |
e81aee2d MK |
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: */ | |
fea681da MK |
33 | .sp |
34 | .B #include <unistd.h> | |
35 | .br | |
36 | .B #include <linux/reboot.h> | |
37 | .sp | |
38 | .BI "int reboot(int " magic ", int " magic2 ", int " flag ", void *" arg ); | |
39 | .sp | |
e81aee2d MK |
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: */ | |
fea681da MK |
43 | .sp |
44 | .B #include <unistd.h> | |
45 | .br | |
46 | .B #include <sys/reboot.h> | |
47 | .sp | |
48 | .BI "int reboot(int " flag ); | |
49 | .SH DESCRIPTION | |
c13182ef | 50 | The |
e511ffb6 | 51 | .BR reboot () |
fea681da MK |
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 | |
55 | .BR loadkeys (1)). | |
56 | .PP | |
682edefb MK |
57 | This system call will fail (with |
58 | .BR EINVAL ) | |
59 | unless | |
fea681da | 60 | .I magic |
682edefb | 61 | equals |
0daa9e92 | 62 | .B LINUX_REBOOT_MAGIC1 |
682edefb | 63 | (that is, 0xfee1dead) and |
fea681da | 64 | .I magic2 |
682edefb | 65 | equals |
0daa9e92 | 66 | .B LINUX_REBOOT_MAGIC2 |
682edefb MK |
67 | (that is, 672274793). |
68 | However, since 2.1.17 also | |
0daa9e92 | 69 | .B LINUX_REBOOT_MAGIC2A |
682edefb MK |
70 | (that is, 85072278) |
71 | and since 2.1.97 also | |
0daa9e92 | 72 | .B LINUX_REBOOT_MAGIC2B |
682edefb MK |
73 | (that is, 369367448) |
74 | and since 2.5.71 also | |
0daa9e92 | 75 | .B LINUX_REBOOT_MAGIC2C |
682edefb | 76 | (that is, 537993216) |
fea681da MK |
77 | are permitted as value for |
78 | .IR magic2 . | |
79 | (The hexadecimal values of these constants are meaningful.) | |
80 | The | |
81 | .I flag | |
82 | argument can have the following values: | |
83 | .TP | |
84 | .B LINUX_REBOOT_CMD_RESTART | |
85 | (RB_AUTOBOOT, 0x1234567). | |
2d986c92 | 86 | The message "Restarting system." is printed, and a default |
fea681da MK |
87 | restart is performed immediately. |
88 | If not preceded by a | |
89 | .BR sync (2), | |
90 | data will be lost. | |
91 | .TP | |
92 | .B LINUX_REBOOT_CMD_HALT | |
93 | (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76). | |
2d986c92 | 94 | The message "System halted." is printed, and the system is halted. |
fea681da MK |
95 | Control is given to the ROM monitor, if there is one. |
96 | If not preceded by a | |
97 | .BR sync (2), | |
98 | data will be lost. | |
99 | .TP | |
100 | .B LINUX_REBOOT_CMD_POWER_OFF | |
101 | (0x4321fedc; since 2.1.30). | |
2d986c92 | 102 | The message "Power down." is printed, the system is stopped, |
fea681da MK |
103 | and all power is removed from the system, if possible. |
104 | If not preceded by a | |
105 | .BR sync (2), | |
106 | data will be lost. | |
107 | .TP | |
108 | .B LINUX_REBOOT_CMD_RESTART2 | |
109 | (0xa1b2c3d4; since 2.1.30). | |
2d986c92 | 110 | The message "Restarting system with command '%s'" is printed, |
fea681da MK |
111 | and a restart (using the command string given in |
112 | .IR arg ) | |
113 | is performed immediately. | |
114 | If not preceded by a | |
115 | .BR sync (2), | |
116 | data will be lost. | |
117 | .TP | |
118 | .B LINUX_REBOOT_CMD_CAD_ON | |
119 | (RB_ENABLE_CAD, 0x89abcdef). | |
120 | CAD is enabled. | |
121 | This means that the CAD keystroke will immediately cause | |
682edefb MK |
122 | the action associated with |
123 | .BR LINUX_REBOOT_CMD_RESTART . | |
fea681da MK |
124 | .TP |
125 | .B LINUX_REBOOT_CMD_CAD_OFF | |
126 | (RB_DISABLE_CAD, 0). | |
127 | CAD is disabled. | |
8bd58774 MK |
128 | This means that the CAD keystroke will cause a |
129 | .B SIGINT | |
130 | signal to be | |
fea681da MK |
131 | sent to init (process 1), whereupon this process may decide upon a |
132 | proper action (maybe: kill all processes, sync, reboot). | |
133 | .LP | |
2c8d1c7d | 134 | Only the superuser may use this function. |
fea681da MK |
135 | .LP |
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. | |
141 | .SH "RETURN VALUE" | |
c13182ef MK |
142 | On success, zero is returned. |
143 | On error, \-1 is returned, and | |
fea681da MK |
144 | .I errno |
145 | is set appropriately. | |
146 | .SH ERRORS | |
147 | .TP | |
148 | .B EFAULT | |
682edefb MK |
149 | Problem with getting userspace data under |
150 | .BR LINUX_REBOOT_CMD_RESTART2 . | |
fea681da MK |
151 | .TP |
152 | .B EINVAL | |
153 | Bad magic numbers or \fIflag\fP. | |
154 | .TP | |
155 | .B EPERM | |
c13182ef | 156 | The calling process has insufficient privilege to call |
e511ffb6 | 157 | .BR reboot (); |
fea681da MK |
158 | the |
159 | .B CAP_SYS_BOOT | |
160 | capability is required. | |
161 | .SH "CONFORMING TO" | |
e511ffb6 | 162 | .BR reboot () |
8382f16d | 163 | is Linux-specific, |
97c1eac8 | 164 | and should not be used in programs intended to be portable. |
fea681da MK |
165 | .SH "SEE ALSO" |
166 | .BR sync (2), | |
167 | .BR bootparam (7), | |
168 | .BR capabilities (7), | |
169 | .BR ctrlaltdel (8), | |
170 | .BR halt (8), | |
171 | .BR reboot (8) |