]>
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. | |
305a0578 | 22 | .\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net> |
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 | |
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: | |
32 | .sp | |
33 | .B #include <unistd.h> | |
34 | .br | |
35 | .B #include <linux/reboot.h> | |
36 | .sp | |
37 | .BI "int reboot(int " magic ", int " magic2 ", int " flag ", void *" arg ); | |
38 | .sp | |
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 | |
41 | system call: | |
42 | .sp | |
43 | .B #include <unistd.h> | |
44 | .br | |
45 | .B #include <sys/reboot.h> | |
46 | .sp | |
47 | .BI "int reboot(int " flag ); | |
48 | .SH DESCRIPTION | |
c13182ef | 49 | The |
e511ffb6 | 50 | .BR reboot () |
fea681da MK |
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 | |
54 | .BR loadkeys (1)). | |
55 | .PP | |
682edefb MK |
56 | This system call will fail (with |
57 | .BR EINVAL ) | |
58 | unless | |
fea681da | 59 | .I magic |
682edefb MK |
60 | equals |
61 | .BR LINUX_REBOOT_MAGIC1 | |
62 | (that is, 0xfee1dead) and | |
fea681da | 63 | .I magic2 |
682edefb MK |
64 | equals |
65 | .BR LINUX_REBOOT_MAGIC2 | |
66 | (that is, 672274793). | |
67 | However, since 2.1.17 also | |
68 | .BR LINUX_REBOOT_MAGIC2A | |
69 | (that is, 85072278) | |
70 | and since 2.1.97 also | |
71 | .BR LINUX_REBOOT_MAGIC2B | |
72 | (that is, 369367448) | |
73 | and since 2.5.71 also | |
74 | .BR LINUX_REBOOT_MAGIC2C | |
75 | (that is, 537993216) | |
fea681da MK |
76 | are permitted as value for |
77 | .IR magic2 . | |
78 | (The hexadecimal values of these constants are meaningful.) | |
79 | The | |
80 | .I flag | |
81 | argument can have the following values: | |
82 | .TP | |
83 | .B LINUX_REBOOT_CMD_RESTART | |
84 | (RB_AUTOBOOT, 0x1234567). | |
85 | The message `Restarting system.' is printed, and a default | |
86 | restart is performed immediately. | |
87 | If not preceded by a | |
88 | .BR sync (2), | |
89 | data will be lost. | |
90 | .TP | |
91 | .B LINUX_REBOOT_CMD_HALT | |
92 | (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76). | |
93 | The message `System halted.' is printed, and the system is halted. | |
94 | Control is given to the ROM monitor, if there is one. | |
95 | If not preceded by a | |
96 | .BR sync (2), | |
97 | data will be lost. | |
98 | .TP | |
99 | .B LINUX_REBOOT_CMD_POWER_OFF | |
100 | (0x4321fedc; since 2.1.30). | |
101 | The message `Power down.' is printed, the system is stopped, | |
102 | and all power is removed from the system, if possible. | |
103 | If not preceded by a | |
104 | .BR sync (2), | |
105 | data will be lost. | |
106 | .TP | |
107 | .B LINUX_REBOOT_CMD_RESTART2 | |
108 | (0xa1b2c3d4; since 2.1.30). | |
109 | The message `Restarting system with command '%s'' is printed, | |
110 | and a restart (using the command string given in | |
111 | .IR arg ) | |
112 | is performed immediately. | |
113 | If not preceded by a | |
114 | .BR sync (2), | |
115 | data will be lost. | |
116 | .TP | |
117 | .B LINUX_REBOOT_CMD_CAD_ON | |
118 | (RB_ENABLE_CAD, 0x89abcdef). | |
119 | CAD is enabled. | |
120 | This means that the CAD keystroke will immediately cause | |
682edefb MK |
121 | the action associated with |
122 | .BR LINUX_REBOOT_CMD_RESTART . | |
fea681da MK |
123 | .TP |
124 | .B LINUX_REBOOT_CMD_CAD_OFF | |
125 | (RB_DISABLE_CAD, 0). | |
126 | CAD is disabled. | |
8bd58774 MK |
127 | This means that the CAD keystroke will cause a |
128 | .B SIGINT | |
129 | signal to be | |
fea681da MK |
130 | sent to init (process 1), whereupon this process may decide upon a |
131 | proper action (maybe: kill all processes, sync, reboot). | |
132 | .LP | |
2c8d1c7d | 133 | Only the superuser may use this function. |
fea681da MK |
134 | .LP |
135 | The precise effect of the above actions depends on the architecture. | |
136 | For the i386 architecture, the additional argument does not do | |
137 | anything at present (2.1.122), but the type of reboot can be | |
138 | determined by kernel command line arguments (`reboot=...') to be | |
139 | either warm or cold, and either hard or through the BIOS. | |
140 | .SH "RETURN VALUE" | |
c13182ef MK |
141 | On success, zero is returned. |
142 | On error, \-1 is returned, and | |
fea681da MK |
143 | .I errno |
144 | is set appropriately. | |
145 | .SH ERRORS | |
146 | .TP | |
147 | .B EFAULT | |
682edefb MK |
148 | Problem with getting userspace data under |
149 | .BR LINUX_REBOOT_CMD_RESTART2 . | |
fea681da MK |
150 | .TP |
151 | .B EINVAL | |
152 | Bad magic numbers or \fIflag\fP. | |
153 | .TP | |
154 | .B EPERM | |
c13182ef | 155 | The calling process has insufficient privilege to call |
e511ffb6 | 156 | .BR reboot (); |
fea681da MK |
157 | the |
158 | .B CAP_SYS_BOOT | |
159 | capability is required. | |
160 | .SH "CONFORMING TO" | |
e511ffb6 | 161 | .BR reboot () |
c13182ef | 162 | is Linux specific, |
97c1eac8 | 163 | and should not be used in programs intended to be portable. |
fea681da MK |
164 | .SH "SEE ALSO" |
165 | .BR sync (2), | |
166 | .BR bootparam (7), | |
167 | .BR capabilities (7), | |
168 | .BR ctrlaltdel (8), | |
169 | .BR halt (8), | |
170 | .BR reboot (8) |