Linux Programmer's Manual --- reboot
REBOOT(2) Linux Programmer's Manual REBOOT(2)
NAME
reboot - reboot or enable/disable Ctrl-Alt-Del
SYNOPSIS
/* For libc4 and libc5 the library call and the system call
are identical, and since kernel version 2.1.30 there are
symbolic names LINUX_REBOOT_* for the constants and a
fourth argument to the call: */
#include <unistd.h>
#include <linux/reboot.h>
int reboot(int magic, int magic2, int cmd, void *arg);
/* Under glibc some of the constants involved have gotten
symbolic names RB_*, and the library call is a 1-argument
wrapper around the 3-argument system call: */
#include <unistd.h>
#include <sys/reboot.h>
int reboot(int cmd);
DESCRIPTION
The reboot() call reboots the system, or enables/disables the reboot keystroke (abbreviated CAD, since the default
is Ctrl-Alt-Delete; it can be changed using loadkeys(1)).
This system call will fail (with EINVAL) unless magic equals LINUX_REBOOT_MAGIC1 (that is, 0xfee1dead) and magic2
equals LINUX_REBOOT_MAGIC2 (that is, 672274793). However, since 2.1.17 also LINUX_REBOOT_MAGIC2A (that is,
85072278) and since 2.1.97 also LINUX_REBOOT_MAGIC2B (that is, 369367448) and since 2.5.71 also
LINUX_REBOOT_MAGIC2C (that is, 537993216) are permitted as value for magic2. (The hexadecimal values of these
constants are meaningful.) The cmd argument can have the following values:
LINUX_REBOOT_CMD_RESTART
(RB_AUTOBOOT, 0x1234567). The message "Restarting system." is printed, and a default restart is performed
immediately. If not preceded by a sync(2), data will be lost.
LINUX_REBOOT_CMD_HALT
(RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76). The message "System halted." is printed, and the system is
halted. Control is given to the ROM monitor, if there is one. If not preceded by a sync(2), data will be
lost.
LINUX_REBOOT_CMD_POWER_OFF
(0x4321fedc; since 2.1.30). The message "Power down." is printed, the system is stopped, and all power is
removed from the system, if possible. If not preceded by a sync(2), data will be lost.
LINUX_REBOOT_CMD_RESTART2
(0xa1b2c3d4; since 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_CAD_ON
(RB_ENABLE_CAD, 0x89abcdef). CAD is enabled. This means that the CAD keystroke will immediately cause the
action associated with LINUX_REBOOT_CMD_RESTART.
LINUX_REBOOT_CMD_CAD_OFF
(RB_DISABLE_CAD, 0). CAD is disabled. This means that the CAD keystroke will cause a SIGINT signal to be
sent to init (process 1), whereupon this process may decide upon a proper action (maybe: kill all pro‐
cesses, sync, reboot).
Only the superuser may call reboot().
The precise effect of the above actions depends on the architecture. For the i386 architecture, the additional
argument does not do anything at present (2.1.122), but the type of reboot can be determined by kernel command-
line arguments ("reboot=...") to be either warm or cold, and either hard or through the BIOS.
RETURN VALUE
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 appro‐
priately.
ERRORS
EFAULT Problem with getting userspace data under LINUX_REBOOT_CMD_RESTART2.
EINVAL Bad magic numbers or cmd.
EPERM The calling process has insufficient privilege to call reboot(); the CAP_SYS_BOOT capability is required.
CONFORMING TO
reboot() is Linux-specific, and should not be used in programs intended to be portable.
SEE ALSO
sync(2), bootparam(7), capabilities(7), ctrlaltdel(8), halt(8), reboot(8)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information
about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-02-11 REBOOT(2)
Linux Programmer's Manual --- reboot的更多相关文章
- Linux User's Manual IOSTAT
IOSTAT(1) Linux User's Manual IOSTAT(1) NAME iostat - Report Central Processing Unit (CPU) statistic ...
- 基于linux与busybox的reboot命令流程分析
http://www.xuebuyuan.com/736763.html 基于Linux与Busybox的Reboot命令流程分析 ********************************** ...
- Linux开关命令(shutdown,reboot,halt,init)
命令简短 shutdown,poweroff,reboot,halt,init都能够进行关机,大致使用方法. /sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] ...
- HTB Linux queuing discipline manual - user guide笔记
1. Introduction HTB is meant as a more understandable, intuitive and faster replacement for the CBQ ...
- linux下c程序调用reboot函数实现直接重启【转】
转自:http://www.blog.chinaunix.net/uid-20564848-id-73878.html linux下c程序调用reboot函数实现直接重启 当然你也可以直接调用syst ...
- #include <sys/epoll.h> epoll - I/O event notification facility 服务器端 epoll(7) - Linux manual page http://www.man7.org/linux/man-pages/man7/epoll.7.html
epoll使用详解(精髓) - Boblim - 博客园 https://www.cnblogs.com/fnlingnzb-learner/p/5835573.html epoll使用详解(精髓) ...
- Linux fstab 参数详解
[root@qs-wg-db1 /]# cat /etc/fstab LABEL=/ / ext3 defaults ...
- 【linux草鞋应用编程系列】_6_ 重定向和VT100编程
一.文件重定向 我们知道在linux shell 编程的时候,可以使用文件重定向功能,如下所示: [root@localhost pipe]# echo "hello world&q ...
- 【linux草鞋应用编程系列】_5_ Linux网络编程
一.网络通信简介 第一部分内容,暂时没法描述,内容实在太多,待后续专门的系列文章. 二.linux网络通信 在linux中继承了Unix下“一切皆文件”的思想, 在linux中要实现网 ...
随机推荐
- Android记事本07
昨天: activity横竖屏切换的生命周期 今天: Anr异常的原因和解决方案 遇到的问题: 无.
- sass mixin 持续更新
控制多行显示省略号... //文字溢出省略号@mixin coveText($num:1){ @if $num == 1{ white-space: normal; overflow: hidden; ...
- Codeforces Round #352 (Div. 2) A
A. Summer Camp time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- oracle的隐式游标
游标的概念: 游标是SQL的一个内存工作区,由系统或用户以变量的形式定义.游标的作用就是用于临时存储从数据库中提取的数据块.在某些情况下,需要把数据从存放在磁盘的表中调到计算机内存中进行处理, ...
- 【Error】Python:UnicodeDecodeError: ‘XXX' codec can't decode bytes in position... 解决方法
错误信息: UnicodeDecodeError: ‘XXX' codec can't decode bytes in position 2-5: illegal multibyte sequence ...
- Windows.Forms Panel 动态加载用户控件 UserControl
创建好一个Windows Forms程序,在创建好的程序中Form1添加一个Panel控件 如图:
- Quartus 调试中的Nios 程序
FPGA的程序通常包含硬件和软件两部分.正常情况下调试需要分别进行下载,过程繁琐. 为了将Nios II的软件程序包含到.sof文件中方便调试,可以在SOPC Builder中的RAM初始化为Nios ...
- 联合权值(NOIP2014)奇特的模拟。。
原题传送门 这道题瞄了一眼还以为是SPFA最短路. 后面发现距离为2.. 好像可以枚举中间点来着? 时间效率O(n*(2n-2))≍O(n^2) BOOM!(PS:9018上过了,说明数据太水了..) ...
- POCO库中文编程参考指南(4)Poco::Net::IPAddress
POCO库中文编程参考指南(4)Poco::Net::IPAddress 作者:柳大·Poechant 博客:Blog.CSDN.net/Poechant 邮箱:zhongchao.ustc#gmai ...
- 关闭vs警告
禁用所有编译器警告 当“解决方案资源管理器”中有项目选中时,在“项目”菜单上单击“属性”. 单击“编译”选项卡. 选中“禁用所有警告”复选框. 禁用单个编译器警告 在“解决方案资源管理器”中选定一个项 ...