reboot(2) System Calls Manual reboot(2) reboot - / Ctrl-Alt-Del LIBRARY Standard C library (libc, -lc) /* Since Linux 2.1.30 there are symbolic names LINUX_REBOOT_* for the constants and a fourth argument to the call: */ #include /* LINUX_REBOOT_* */ #include /* SYS_* */ #include int syscall(SYS_reboot, int magic, int magic2, int cmd, void *arg); /* glibc libc ( uclibc, deitlibc, musl ) RB_*, : */ #include /* RB_* */ #include int reboot(int cmd); reboot() / ( CAD, -- Ctrl-Alt-Delete; loadkeys(1)). This system call fails (with the error EINVAL) unless magic equals LINUX_REBOOT_MAGIC1 (that is, 0xfee1dead) and magic2 equals LINUX_REBOOT_MAGIC2 (that is, 0x28121969). However, since Linux 2.1.17 also LINUX_REBOOT_MAGIC2A (that is, 0x05121996) and since Linux 2.1.97 also LINUX_REBOOT_MAGIC2B (that is, 0x16041998) and since Linux 2.5.71 also LINUX_REBOOT_MAGIC2C (that is, 0x20112000) are permitted as values for magic2. (The hexadecimal values of these constants are meaningful.) cmd : LINUX_REBOOT_CMD_CAD_OFF (RB_DISABLE_CAD, 0). (CAD). , CAD , init ( 1) SIGINT, (, , sync, reboot). LINUX_REBOOT_CMD_CAD_ON (RB_ENABLE_CAD, 0x89abcdef). (CAD). , CAD , LINUX_REBOOT_CMD_RESTART. LINUX_REBOOT_CMD_HALT (RB_HALT_SYSTEM, 0xcdef0123; Linux 1.1.76) <> . , . sync(2), . LINUX_REBOOT_CMD_KEXEC (RB_KEXEC, 0x45584543, Linux 2.6.13) , kexec_load(2). , CONFIG_KEXEC. LINUX_REBOOT_CMD_POWER_OFF (RB_POWER_OFF, 0x4321fedc; Linux 2.1.30) <>, , , . sync(2), . LINUX_REBOOT_CMD_RESTART (RB_AUTOBOOT, 0x1234567) <>, . sync(2), . LINUX_REBOOT_CMD_RESTART2 (0xa1b2c3d4; since Linux 2.1.30). The message "Restarting system with command '%s'" is printed, and a restart (using the command string given in arg) is performed immediately. If not preceded by a sync(2), data will be lost. LINUX_REBOOT_CMD_SW_SUSPEND (RB_SW_SUSPEND, 0xd000fce1; Linux 2.5.18) (suspended, hibernated) . , CONFIG_HIBERNATION. reboot(). . i386, (2.1.122), ("reboot=..."), , "" "", BIOS. PID Linux 3.4, reboot() PID, PID, cmd , <<>> : <> PID , , pid_namespaces(7). , cmd reboot(), : LINUX_REBOOT_CMD_RESTART LINUX_REBOOT_CMD_RESTART2 <> wait(2) , SIGHUP. LINUX_REBOOT_CMD_POWER_OFF LINUX_REBOOT_CMD_HALT <> wait(2) , SIGINT. cmd reboot() -1 errno EINVAL. For the values of cmd that stop or restart the system, a successful call to reboot() does not return. For the other cmd values, zero is returned on success. In all cases, -1 is returned on failure, and errno is set to indicate the error. EFAULT LINUX_REBOOT_CMD_RESTART2. EINVAL cmd. EPERM reboot(); CAP_SETGID . Linux. . systemctl(1), systemd(1), kexec_load(2), sync(2), bootparam(7), capabilities(7), ctrlaltdel(8), halt(8), shutdown(8) aereiae , Azamat Hackimov , Dmitriy S. Seregin , Katrin Kutepova , Lockal , Yuri Kozlov , ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . reboot(2)