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中要实现网 ...
随机推荐
- css深入理解relative
第一讲 relative和absolute相煎关系 同源性 .position:relative .position:absolute 限制作用 1.限制left/top/right/bott ...
- 软工实践Alpha冲刺(10/10)
队名:起床一起肝活队 组长博客:博客链接 作业博客:班级博客本次作业的链接 组员情况 组员1(队长):白晨曦 过去两天完成了哪些任务 描述: 完成所有界面的链接,整理与测试 展示GitHub当日代码/ ...
- 【Android】实验3 颜色、字符串资源的使用【提交截止时间:2016.4.1】
实验4 颜色.字符串资源的使用 [目的] 掌握Android中颜色和字符串资源的使用方法. 理解Android中尺寸和布局资源的使用方法. [要求] 在工程中为Activity.View使用颜色资源: ...
- nagios客户端安装
在被监控服务器(Linux/unix)上安装Nagios-plugins和nrpe 1.添加用户 1 2 ; html-script: false ]/usr/sbin/useradd -m na ...
- java 图形化界面笔记(1)
目录 JFrame窗体......................................................................................... ...
- [SDOI2015][bzoj4518] 征途 [斜率优化dp]
题面 传送门 思路 把$vm^2$展开化一下式子,可以得到这样的等价公式: $vm^2=m\sum_{i=1}^m a_i^2-\sum_{i=1}^m a_i$ 那么我们要最小化的就是$\sum_{ ...
- Where to Run LightOJ - 1287(概率dp)
Where to Run LightOJ - 1287(概率dp) 题面长长的,看了半天也没看懂题意 不清楚的地方,如何判断一个点是否是EJ 按照我的理解 在一个EJ点处,要么原地停留五分钟接着走,要 ...
- [解决方案]NuGet打包报错: 'X' already has a dependency defined for 'Y'
大家在打包Nuget包的时候,最后会执行以下语句 nuget pack .\ML.Common.SDK.csproj -Prop Configuration=Release 执行此句后,提示以下报错信 ...
- HDU 5690 矩阵快速幂
All X Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submi ...
- .net yield return
yield在迭代器块中用于向枚举数对象提供值或发出迭代结束信号.它的形式为下列之一: yield return <expression>; yield break; 计算表达式并以枚举数对 ...