static void sysrq_handle_kill(int key) { send_sig_all(SIGKILL); console_loglevel = 8; }
static void sysrq_handle_term(int key) { send_sig_all(SIGTERM); console_loglevel = 8; }
static void sysrq_handle_term(int key, struct pt_regs *pt_regs, struct tty_struct *tty) { send_sig_all(SIGTERM); console_loglevel = 8; }
static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, struct tty_struct *tty) { send_sig_all(SIGKILL); console_loglevel = 8; }
void handle_sysrq(int key, struct pt_regs *pt_regs, struct kbd_struct *kbd, struct tty_struct *tty) { int orig_log_level = console_loglevel; if (!key) return; console_loglevel = 7; printk(KERN_INFO "SysRq: "); switch (key) { case 'r': /* R -- Reset raw mode */ if (kbd) { kbd->kbdmode = VC_XLATE; printk("Keyboard mode set to XLATE\n"); } break; #ifdef CONFIG_VT case 'k': /* K -- SAK */ printk("SAK\n"); if (tty) do_SAK(tty); reset_vc(fg_console); break; #endif case 'b': /* B -- boot immediately */ printk("Resetting\n"); machine_restart(NULL); break; case 'o': /* O -- power off */ if (sysrq_power_off) { printk("Power off\n"); sysrq_power_off(); } break; case 's': /* S -- emergency sync */ printk("Emergency Sync\n"); emergency_sync_scheduled = EMERG_SYNC; wakeup_bdflush(0); break; case 'u': /* U -- emergency remount R/O */ printk("Emergency Remount R/O\n"); emergency_sync_scheduled = EMERG_REMOUNT; wakeup_bdflush(0); break; case 'p': /* P -- show PC */ printk("Show Regs\n"); if (pt_regs) show_regs(pt_regs); break; case 't': /* T -- show task info */ printk("Show State\n"); show_state(); break; case 'm': /* M -- show memory info */ printk("Show Memory\n"); show_mem(); break; case '0' ... '9': /* 0-9 -- set console logging level */ orig_log_level = key - '0'; printk("Log level set to %d\n", orig_log_level); break; case 'e': /* E -- terminate all user processes */ printk("Terminate All Tasks\n"); send_sig_all(SIGTERM, 0); orig_log_level = 8; /* We probably have killed syslogd */ break; case 'i': /* I -- kill all user processes */ printk("Kill All Tasks\n"); send_sig_all(SIGKILL, 0); orig_log_level = 8; break; case 'l': /* L -- kill all processes including init */ printk("Kill ALL Tasks (even init)\n"); send_sig_all(SIGKILL, 1); orig_log_level = 8; break; default: /* Unknown: help */ if (kbd) printk("unRaw "); #ifdef CONFIG_VT if (tty) printk("saK "); #endif printk("Boot "); if (sysrq_power_off) printk("Off "); printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n"); /* Don't use 'A' as it's handled specially on the Sparc */ } console_loglevel = orig_log_level; }