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

DESCRIPTION

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

RETURN VALUE

84       On success, zero is returned.  On error, -1 is returned, and  errno  is
85       set appropriately.
86

ERRORS

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

CONFORMING TO

97       reboot() is Linux specific, and should not be used in programs intended
98       to be portable.
99

SEE ALSO

101       sync(2),   bootparam(7),   capabilities(7),   ctrlaltdel(8),   halt(8),
102       reboot(8)
103
104
105
106Linux 2.6.6                       2004-05-27                         REBOOT(2)
Impressum