aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/mconsole_kern.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index e9bbc14f3655..8b453a7e685c 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -463,24 +463,6 @@ void mconsole_remove(struct mc_request *req)
463 mconsole_reply(req, err_msg, err, 0); 463 mconsole_reply(req, err_msg, err, 0);
464} 464}
465 465
466#ifdef CONFIG_MAGIC_SYSRQ
467void mconsole_sysrq(struct mc_request *req)
468{
469 char *ptr = req->request.data;
470
471 ptr += strlen("sysrq");
472 while(isspace(*ptr)) ptr++;
473
474 mconsole_reply(req, "", 0, 0);
475 handle_sysrq(*ptr, &current->thread.regs, NULL);
476}
477#else
478void mconsole_sysrq(struct mc_request *req)
479{
480 mconsole_reply(req, "Sysrq not compiled in", 1, 0);
481}
482#endif
483
484static DEFINE_SPINLOCK(console_lock); 466static DEFINE_SPINLOCK(console_lock);
485static LIST_HEAD(clients); 467static LIST_HEAD(clients);
486static char console_buf[MCONSOLE_MAX_DATA]; 468static char console_buf[MCONSOLE_MAX_DATA];
@@ -549,6 +531,36 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
549 list_del(&entry.list); 531 list_del(&entry.list);
550} 532}
551 533
534#ifdef CONFIG_MAGIC_SYSRQ
535static void sysrq_proc(void *arg)
536{
537 char *op = arg;
538
539 handle_sysrq(*op, &current->thread.regs, NULL);
540}
541
542void mconsole_sysrq(struct mc_request *req)
543{
544 char *ptr = req->request.data;
545
546 ptr += strlen("sysrq");
547 while(isspace(*ptr)) ptr++;
548
549 /* With 'b', the system will shut down without a chance to reply,
550 * so in this case, we reply first.
551 */
552 if(*ptr == 'b')
553 mconsole_reply(req, "", 0, 0);
554
555 with_console(req, sysrq_proc, ptr);
556}
557#else
558void mconsole_sysrq(struct mc_request *req)
559{
560 mconsole_reply(req, "Sysrq not compiled in", 1, 0);
561}
562#endif
563
552static void stack_proc(void *arg) 564static void stack_proc(void *arg)
553{ 565{
554 struct task_struct *from = current, *to = arg; 566 struct task_struct *from = current, *to = arg;