Documentation/translations/zh_CN/admin-guide/sysrq.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/admin-guide/sysrq.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/admin-guide/sysrq.rst- Extension
.rst- Size
- 13006 bytes
- Lines
- 281
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. include:: ../disclaimer-zh_CN.rst
:Original: Documentation/admin-guide/sysrq.rst
:翻译:
黄军华 Junhua Huang <huang.junhua@zte.com.cn>
:校译:
司延腾 Yanteng Si <siyanteng@loongson.cn>
.. _cn_admin-guide_sysrq:
Linux 魔法系统请求键骇客
========================
针对 sysrq.c 的文档说明
什么是魔法 SysRq 键?
~~~~~~~~~~~~~~~~~~~~~
它是一个你可以输入的具有魔法般的组合键。
无论内核在做什么,内核都会响应 SysRq 键的输入,除非内核完全卡死。
如何使能魔法 SysRq 键?
~~~~~~~~~~~~~~~~~~~~~~~
在配置内核时,我们需要设置 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' 为 'Y'。
当运行一个编译进 sysrq 功能的内核时,/proc/sys/kernel/sysrq 控制着被
SysRq 键调用的功能许可。这个文件的默认值由 CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE
配置符号设定,文件本身默认设置为 1。以下是 /proc/sys/kernel/sysrq 中可能的
值列表:
- 0 - 完全不使能 SysRq 键
- 1 - 使能 SysRq 键的全部功能
- >1 - 对于允许的 SysRq 键功能的比特掩码(参见下面更详细的功能描述)::
2 = 0x2 - 使能对控制台日志记录级别的控制
4 = 0x4 - 使能对键盘的控制 (SAK, unraw)
8 = 0x8 - 使能对进程的调试导出等
16 = 0x10 - 使能同步命令
32 = 0x20 - 使能重新挂载只读
64 = 0x40 - 使能对进程的信号操作 (term, kill, oom-kill)
128 = 0x80 - 允许重启、断电
256 = 0x100 - 允许让所有实时任务变普通任务
你可以通过如下命令把值设置到这个文件中::
echo "number" >/proc/sys/kernel/sysrq
这里被写入的 number 可以是 10 进制数,或者是带着 0x 前缀的 16 进制数。
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE 必须是以 16 进制数写入。
注意,``/proc/sys/kernel/sysrq`` 的值只影响通过键盘触发 SySRq 的调用,对于
通过 ``/proc/sysrq-trigger`` 的任何操作调用都是允许的
(通过具有系统权限的用户)。
如何使用魔法 SysRq 键?
~~~~~~~~~~~~~~~~~~~~~~~
在 x86 架构上
你可以按下键盘组合键 `ALT-SysRq-<command key>`。
.. note::
一些键盘可能没有标识 'SySRq' 键。'SySRq' 键也被当做 'Print Screen'键。
同时有些键盘无法处理同时按下这么多键,因此你可以先按下键盘 `Alt` 键,
然后按下键盘 `SysRq` 键,再释放键盘 `SysRq` 键,之后按下键盘上命令键
`<command key>`,最后释放所有键。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.