lkml.org 
[lkml]   [2000]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Magic SysRq help
On more than one occasion I have been hit by a situation where I wished
I could remember which Magic SysRq key to use. So I wrote the following
patch: Alt+SysRq+h to print the list of keys, taken from the SysRq
Documentation. I thought I'd share it here, hoping that other people
would also find it useful. It's against 2.2.16 but probably works on
many other kernel versions too.

--- linux/drivers/char/sysrq.c.vanilla Mon Jun 26 20:57:13 2000
+++ linux/drivers/char/sysrq.c Mon Jun 26 21:08:53 2000
@@ -67,6 +67,10 @@
console_loglevel = 7;
printk(KERN_INFO "SysRq: ");
switch (key) {
+ case 'h': /* H -- Help */
+ printk("Help\n");
+ print_sysrq_help();
+ break;
case 'r': /* R -- Reset raw mode */
if (kbd) {
kbd->kbdmode = VC_XLATE;
@@ -255,4 +259,22 @@

unlock_kernel();
printk(KERN_INFO "Done.\n");
+}
+
+static void print_sysrq_help(void)
+{
+ printk("'h' - This help information.\n");
+ printk("'r' - Turns off keyboard raw mode and sets it to XLATE.\n");
+ printk("'k' - Kills all programs on the current virtual console.\n");
+ printk("'b' - Will immediately reboot the system without syncing or unmounting your disks.\n");
+ printk("'o' - Will shut your system off (if configured and supported).\n");
+ printk("'s' - Will attempt to sync all mounted filesystems.\n");
+ printk("'u' - Will attempt to remount all mounted filesystems read-only.\n");
+ printk("'p' - Will dump the current registers and flags to your console.\n");
+ printk("'t' - Will dump a list of current tasks and their information to your console.\n");
+ printk("'m' - Will dump current memory info to your console.\n");
+ printk("'0'-'9' - Sets the console log level, controlling which kernel messages will be printed to your console.\n");
+ printk("'e' - Send a SIGTERM to all processes, except for init.\n");
+ printk("'i' - Send a SIGKILL to all processes, except for init.\n");
+ printk("'l' - Send a SIGKILL to all processes, INCLUDING init.\n");
}


--
Alan Ford * alan@whirlnet.co.uk * DFax: +44 (0)870 1600868
WWW: http://www.whirlnet.co.uk/ * PGP: 0x8F807D7D * GPG: 0x673BA843
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.031 / U:2.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site