]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/reboot.2
Fix redundant formatting macros
[thirdparty/man-pages.git] / man2 / reboot.2
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.
11 .\"
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.
19 .\"
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
24 .\"
25 .TH REBOOT 2 2004-05-27 "Linux" "Linux Programmer's Manual"
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
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: */
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
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: */
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
50 The
51 .BR reboot ()
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
57 This system call will fail (with
58 .BR EINVAL )
59 unless
60 .I magic
61 equals
62 .B LINUX_REBOOT_MAGIC1
63 (that is, 0xfee1dead) and
64 .I magic2
65 equals
66 .B LINUX_REBOOT_MAGIC2
67 (that is, 672274793).
68 However, since 2.1.17 also
69 .B LINUX_REBOOT_MAGIC2A
70 (that is, 85072278)
71 and since 2.1.97 also
72 .B LINUX_REBOOT_MAGIC2B
73 (that is, 369367448)
74 and since 2.5.71 also
75 .B LINUX_REBOOT_MAGIC2C
76 (that is, 537993216)
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).
86 The message `Restarting system.' is printed, and a default
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).
94 The message `System halted.' is printed, and the system is halted.
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).
102 The message `Power down.' is printed, the system is stopped,
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).
110 The message `Restarting system with command '%s'' is printed,
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
122 the action associated with
123 .BR LINUX_REBOOT_CMD_RESTART .
124 .TP
125 .B LINUX_REBOOT_CMD_CAD_OFF
126 (RB_DISABLE_CAD, 0).
127 CAD is disabled.
128 This means that the CAD keystroke will cause a
129 .B SIGINT
130 signal to be
131 sent to init (process 1), whereupon this process may decide upon a
132 proper action (maybe: kill all processes, sync, reboot).
133 .LP
134 Only the superuser may use this function.
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"
142 On success, zero is returned.
143 On error, \-1 is returned, and
144 .I errno
145 is set appropriately.
146 .SH ERRORS
147 .TP
148 .B EFAULT
149 Problem with getting userspace data under
150 .BR LINUX_REBOOT_CMD_RESTART2 .
151 .TP
152 .B EINVAL
153 Bad magic numbers or \fIflag\fP.
154 .TP
155 .B EPERM
156 The calling process has insufficient privilege to call
157 .BR reboot ();
158 the
159 .B CAP_SYS_BOOT
160 capability is required.
161 .SH "CONFORMING TO"
162 .BR reboot ()
163 is Linux specific,
164 and should not be used in programs intended to be portable.
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)