diff options
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 48 |
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 | ||
467 | void 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, ¤t->thread.regs, NULL); | ||
476 | } | ||
477 | #else | ||
478 | void mconsole_sysrq(struct mc_request *req) | ||
479 | { | ||
480 | mconsole_reply(req, "Sysrq not compiled in", 1, 0); | ||
481 | } | ||
482 | #endif | ||
483 | |||
484 | static DEFINE_SPINLOCK(console_lock); | 466 | static DEFINE_SPINLOCK(console_lock); |
485 | static LIST_HEAD(clients); | 467 | static LIST_HEAD(clients); |
486 | static char console_buf[MCONSOLE_MAX_DATA]; | 468 | static 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 | ||
535 | static void sysrq_proc(void *arg) | ||
536 | { | ||
537 | char *op = arg; | ||
538 | |||
539 | handle_sysrq(*op, ¤t->thread.regs, NULL); | ||
540 | } | ||
541 | |||
542 | void 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 | ||
558 | void mconsole_sysrq(struct mc_request *req) | ||
559 | { | ||
560 | mconsole_reply(req, "Sysrq not compiled in", 1, 0); | ||
561 | } | ||
562 | #endif | ||
563 | |||
552 | static void stack_proc(void *arg) | 564 | static void stack_proc(void *arg) |
553 | { | 565 | { |
554 | struct task_struct *from = current, *to = arg; | 566 | struct task_struct *from = current, *to = arg; |