1REBOOT(2)                  Linux Programmer's Manual                 REBOOT(2)
2
3
4

NAME

6       reboot - reboot or enable/disable Ctrl-Alt-Del
7

SYNOPSIS

9       /* For libc4 and libc5 the library call and the system call
10          are identical, and since kernel version 2.1.30 there are
11          symbolic names LINUX_REBOOT_* for the constants and a
12          fourth argument to the call: */
13
14       #include <unistd.h>
15       #include <linux/reboot.h>
16
17       int reboot(int magic, int magic2, int cmd, void *arg);
18
19       /* Under glibc some of the constants involved have gotten
20          symbolic names RB_*, and the library call is a 1-argument
21          wrapper around the 3-argument system call: */
22
23       #include <unistd.h>
24       #include <sys/reboot.h>
25
26       int reboot(int cmd);
27

DESCRIPTION

29       The  reboot()  call  reboots the system, or enables/disables the reboot
30       keystroke (abbreviated CAD, since the default  is  Ctrl-Alt-Delete;  it
31       can be changed using loadkeys(1)).
32
33       This   system   call  will  fail  (with  EINVAL)  unless  magic  equals
34       LINUX_REBOOT_MAGIC1   (that   is,   0xfee1dead)   and   magic2   equals
35       LINUX_REBOOT_MAGIC2  (that  is, 672274793).  However, since 2.1.17 also
36       LINUX_REBOOT_MAGIC2A  (that  is,  85072278)  and  since   2.1.97   also
37       LINUX_REBOOT_MAGIC2B   (that  is,  369367448)  and  since  2.5.71  also
38       LINUX_REBOOT_MAGIC2C (that is, 537993216) are permitted  as  value  for
39       magic2.   (The  hexadecimal  values of these constants are meaningful.)
40       The cmd argument can have the following values:
41
42       LINUX_REBOOT_CMD_RESTART
43              (RB_AUTOBOOT, 0x1234567).  The message "Restarting  system."  is
44              printed, and a default restart is performed immediately.  If not
45              preceded by a sync(2), data will be lost.
46
47       LINUX_REBOOT_CMD_HALT
48              (RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76).  The message "System
49              halted." is printed, and the system is halted.  Control is given
50              to the ROM monitor, if there is  one.   If  not  preceded  by  a
51              sync(2), data will be lost.
52
53       LINUX_REBOOT_CMD_POWER_OFF
54              (0x4321fedc;  since  2.1.30).   The  message  "Power  down."  is
55              printed, the system is stopped, and all power  is  removed  from
56              the  system,  if  possible.   If not preceded by a sync(2), data
57              will be lost.
58
59       LINUX_REBOOT_CMD_RESTART2
60              (0xa1b2c3d4; since 2.1.30).  The message "Restarting system with
61              command  '%s'"  is  printed,  and  a  restart (using the command
62              string given in arg) is performed immediately.  If not  preceded
63              by a sync(2), data will be lost.
64
65       LINUX_REBOOT_CMD_CAD_ON
66              (RB_ENABLE_CAD,  0x89abcdef).   CAD is enabled.  This means that
67              the CAD keystroke will immediately cause the  action  associated
68              with LINUX_REBOOT_CMD_RESTART.
69
70       LINUX_REBOOT_CMD_CAD_OFF
71              (RB_DISABLE_CAD,  0).  CAD is disabled.  This means that the CAD
72              keystroke will cause a SIGINT signal to be sent to init (process
73              1),  whereupon  this  process  may  decide  upon a proper action
74              (maybe: kill all processes, sync, reboot).
75
76       Only the superuser may call reboot().
77
78       The precise effect of the above actions depends  on  the  architecture.
79       For the i386 architecture, the additional argument does not do anything
80       at present (2.1.122), but the type of reboot can be determined by  ker‐
81       nel  command-line  arguments  ("reboot=...") to be either warm or cold,
82       and either hard or through the BIOS.
83

RETURN VALUE

85       For the values of cmd that stop or restart  the  system,  a  successful
86       call  to  reboot()  does not return.  For the other cmd values, zero is
87       returned on success.  In all cases, -1  is  returned  on  failure,  and
88       errno is set appropriately.
89

ERRORS

91       EFAULT Problem      with      getting      userspace     data     under
92              LINUX_REBOOT_CMD_RESTART2.
93
94       EINVAL Bad magic numbers or cmd.
95
96       EPERM  The calling process has insufficient privilege to call reboot();
97              the CAP_SYS_BOOT capability is required.
98

CONFORMING TO

100       reboot() is Linux-specific, and should not be used in programs intended
101       to be portable.
102

SEE ALSO

104       sync(2),   bootparam(7),   capabilities(7),   ctrlaltdel(8),   halt(8),
105       reboot(8)
106

COLOPHON

108       This  page  is  part of release 3.25 of the Linux man-pages project.  A
109       description of the project, and information about reporting  bugs,  can
110       be found at http://www.kernel.org/doc/man-pages/.
111
112
113
114Linux                             2008-02-11                         REBOOT(2)
Impressum