aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 00:19:05 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 08:33:48 -0800
commit4111b025dc64f33803d2147565147428dc51d014 (patch)
tree9eaf09fd540df937c40d16a973c11f0427c0c1b0 /arch
parent6f517d3fc862d3c8d8ba65c0b2472d399aceb9ed (diff)
[PATCH] uml: capture printk output for mconsole sysrq
Pass sysrq output back to the mconsole client using the mechanism introduced for stack output. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 e9bbc14f365..8b453a7e685 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)
mconsole_reply(req, err_msg, err, 0);
}
-#ifdef CONFIG_MAGIC_SYSRQ
-void mconsole_sysrq(struct mc_request *req)
-{
- char *ptr = req->request.data;
-
- ptr += strlen("sysrq");
- while(isspace(*ptr)) ptr++;
-
- mconsole_reply(req, "", 0, 0);
- handle_sysrq(*ptr, &current->thread.regs, NULL);
-}
-#else
-void mconsole_sysrq(struct mc_request *req)
-{
- mconsole_reply(req, "Sysrq not compiled in", 1, 0);
-}
-#endif
-
static DEFINE_SPINLOCK(console_lock);
static LIST_HEAD(clients);
static char console_buf[MCONSOLE_MAX_DATA];
@@ -549,6 +531,36 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
list_del(&entry.list);
}
+#ifdef CONFIG_MAGIC_SYSRQ
+static void sysrq_proc(void *arg)
+{
+ char *op = arg;
+
+ handle_sysrq(*op, &current->thread.regs, NULL);
+}
+
+void mconsole_sysrq(struct mc_request *req)
+{
+ char *ptr = req->request.data;
+
+ ptr += strlen("sysrq");
+ while(isspace(*ptr)) ptr++;
+
+ /* With 'b', the system will shut down without a chance to reply,
+ * so in this case, we reply first.
+ */
+ if(*ptr == 'b')
+ mconsole_reply(req, "", 0, 0);
+
+ with_console(req, sysrq_proc, ptr);
+}
+#else
+void mconsole_sysrq(struct mc_request *req)
+{
+ mconsole_reply(req, "Sysrq not compiled in", 1, 0);
+}
+#endif
+
static void stack_proc(void *arg)
{
struct task_struct *from = current, *to = arg;