[linux device driver] Chapter 04:Magic SysRq Key
来源:互联网 发布:网络结婚证在线制作 编辑:程序博客网 时间:2024/05/13 11:40
在开发Linux内核或者驱动中,有时会发生内核错误,这个时候SysRq将会非常有用。它是一个组合键,用于恢复系统,一般是Alt+SysRq+commandkey,在很多系统中SysRq是Print Screen键。
首先要检查 /proc/sys/kernel/sysrq,看其是不是1,如果是1则代表SysRq打开了。
下面是对应的commandkey及其作用:
- ‘k’ – Kills all the process running on the current virtual console.
- ‘s’ – This will attempt to sync all the mounted file system.
- ‘b’ – Immediately reboot the system, without unmounting partitions or syncing.
- ‘e’ – Sends SIGTERM to all process except init.
- ‘m’ – Output current memory information to the console.
- ‘i’ – Send the SIGKILL signal to all processes except init
- ‘r’ – Switch the keyboard from raw mode (the mode used by programs such as X11), to XLATE mode.
- ‘s’ – sync all mounted file system.
- ‘t’ – Output a list of current tasks and their information to the console.
- ‘u’ – Remount all mounted filesystems in readonly mode.
- ‘o’ – Shutdown the system immediately.
- ‘p’ – Print the current registers and flags to the console.
- ’0-9′ – Sets the console log level, controlling which kernel messages will be printed to your console.
- ‘f’ – Will call oom_kill to kill process which takes more memory.
- ‘h’ – Used to display the help. But any other keys than the above listed will print help.
同样我们也可以echo 对应的key到/proc/sysrq-trigger中,比如这样:
echo "b" > /proc/sysrq-trigger
不同的字符含义如下:
- unRaw (take control of keyboard back from X11,
- tErminate (send SIGTERM to all processes, allowing them to terminate gracefully),
- KIll (send SIGILL to all processes, forcing them to terminate immediately),
- Sync (flush data to disk),
- Unmount (remount all filesystems read-only),
- reBoot
0 0
- [linux device driver] Chapter 04:Magic SysRq Key
- Linux magic sysrq key
- [linux device driver] Chapter 04:使用/proc文件系统查询调试
- [linux device driver] Chapter 03:scullc_open理解
- Debug System Hang with “magic SysRq key"
- [linux device driver] Chapter 03:字符设备注册学习
- [linux device driver] Chapter 03:IS_ERR的理解
- [linux device driver] Chapter 14:kobject_init的理解
- [linux device driver] Chapter 03:make输出重定向
- [linux device driver] Chapter 03:scull_load脚本理解
- [linux device driver] Chapter 03:从scull_load了解awk
- Linux Device Driver: char device
- linux device driver
- Linux device driver
- Linux device driver
- Linux Device Driver
- Linux Device Driver Summarization
- Linux device driver
- C++复杂对象之常对象
- C Primer Plus 练习 7-4
- 30 Unforgettable Books Every Parent Should Read To Their Kids Before They Grow Up
- nyoj171聪明的KK(dp动态规划)
- PAT A1035. Password (20)
- [linux device driver] Chapter 04:Magic SysRq Key
- nyoj63小猴下落(数据结构 二叉树)
- remote_login_passwordfile&&sqlnet.authenication_services
- HDU5182 PM2.5
- iOS的xmppframework简介--经典推荐
- Python中逗号的作用
- nyoj56阶乘因式分解(一)
- Q1:动态链表的使用、反序、连接
- 解决 pb插入ole控件点击insert control时关闭他PB插入OCX控件程序崩溃问题