lkml.org 
[lkml]   [2009]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] sysrq: add debug message to reboot event
Add debug message to detect keyboard vs non-keyboard
triggered sysrq-b events.

Signed-off-by: Tina Yang <Tina.Yang@oracle.com>
Signed-off-by: Zach Brown <Zach.Brown@oracle.com>

---

--- linux-2.6.git/drivers/char/sysrq.c.orig 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.git/drivers/char/sysrq.c 2009-08-13 21:51:15.832694000 -0700
@@ -135,17 +135,22 @@ static struct sysrq_key_op sysrq_crash_o
.enable_mask = SYSRQ_ENABLE_DUMP,
};

-static void sysrq_handle_reboot(int key, struct tty_struct *tty)
+static void sysrq_handle_reboot(int check_mask, int key, struct
tty_struct *tty)
{
+ if (check_mask)
+ printk("<keyboard-invoked>\n");
+ else
+ printk("<non-keyboard-invoked: PID %d COMMAND %s>\n",
+ current->pid, current->comm);
lockdep_off();
local_irq_enable();
emergency_restart();
}
static struct sysrq_key_op sysrq_reboot_op = {
- .handler = sysrq_handle_reboot,
- .help_msg = "reBoot",
- .action_msg = "Resetting",
- .enable_mask = SYSRQ_ENABLE_BOOT,
+ .handler_with_mask = sysrq_handle_reboot,
+ .help_msg = "reBoot",
+ .action_msg = "Resetting",
+ .enable_mask = SYSRQ_ENABLE_BOOT,
};

static void sysrq_handle_sync(int key, struct tty_struct *tty)
@@ -509,7 +514,10 @@ void __handle_sysrq(int key, struct tty_
if (!check_mask || sysrq_on_mask(op_p->enable_mask)) {
printk("%s\n", op_p->action_msg);
console_loglevel = orig_log_level;
- op_p->handler(key, tty);
+ if (op_p->handler_with_mask)
+ op_p->handler_with_mask(check_mask, key,
tty);
+ else
+ op_p->handler(key, tty);
} else {
printk("This sysrq operation is disabled.\n");
}
--- linux-2.6.git/include/linux/sysrq.h.orig 2009-08-13
20:53:48.085786000 -0700
+++ linux-2.6.git/include/linux/sysrq.h 2009-08-13 20:54:12.625756000 -0700
@@ -32,6 +32,7 @@ struct tty_struct;

struct sysrq_key_op {
void (*handler)(int, struct tty_struct *);
+ void (*handler_with_mask)(int, int, struct tty_struct *);
char *help_msg;
char *action_msg;
int enable_mask;


\
 
 \ /
  Last update: 2009-08-17 21:21    [W:0.096 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site