1 --- a/arch/um/drivers/mconsole_kern.c 2008-04-17 04:49:44.000000000 +0200
2 +++ b/arch/um/drivers/mconsole_kern.c 2008-07-07 13:55:48.000000000 +0200
4 * Licensed under the GPL
7 +#include "linux/kmod.h"
8 #include <linux/console.h>
9 #include <linux/ctype.h>
10 #include <linux/interrupt.h>
15 +void mconsole_exec(struct mc_request *req)
19 + char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
20 + char *argv[] = { "/bin/sh", "-c", req->request.data + strlen("exec "), NULL };
21 + res = call_usermodehelper("/bin/sh", argv, envp, 0);
25 + snprintf(buf, 60, "call_usermodehelper failed in mconsole_exec with error code: %d", -res);
26 + mconsole_reply(req, buf, 1, 0);
30 + mconsole_reply(req, "The command has been started successfully.", 0, 0);
33 void mconsole_proc(struct mc_request *req)
37 stop - pause the UML; it will do nothing until it receives a 'go' \n\
38 go - continue the UML after a 'stop' \n\
39 log <string> - make UML enter <string> into the kernel log\n\
40 + exec <string> - pass <string> to /bin/sh -c in guest\n\
41 proc <file> - returns the contents of the UML's /proc/<file>\n\
42 stack <pid> - returns the stack of the specified pid\n\
44 --- a/arch/um/drivers/mconsole_user.c 2008-05-21 18:34:47.000000000 +0200
45 +++ b/arch/um/drivers/mconsole_user.c 2008-07-07 13:47:13.000000000 +0200
47 { "stop", mconsole_stop, MCONSOLE_PROC },
48 { "go", mconsole_go, MCONSOLE_INTR },
49 { "log", mconsole_log, MCONSOLE_INTR },
50 + { "exec", mconsole_exec, MCONSOLE_PROC },
51 { "proc", mconsole_proc, MCONSOLE_PROC },
52 { "stack", mconsole_stack, MCONSOLE_INTR },
54 --- a/arch/um/include/mconsole.h 2008-04-17 04:49:44.000000000 +0200
55 +++ b/arch/um/include/mconsole.h 2008-07-07 13:46:56.000000000 +0200
57 extern void mconsole_stop(struct mc_request *req);
58 extern void mconsole_go(struct mc_request *req);
59 extern void mconsole_log(struct mc_request *req);
60 +extern void mconsole_exec(struct mc_request *req);
61 extern void mconsole_proc(struct mc_request *req);
62 extern void mconsole_stack(struct mc_request *req);