summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdike <jdike>2003-08-07 18:55:35 +0000
committerjdike <jdike>2003-08-07 18:55:35 +0000
commit81ea4710db70d7153c13ba78b7f8b2e8a1bf6143 (patch)
treefd8c07cafb0b690e4a1b3ff7dc2873807e6155f3
parent3ba5545d81d0399c1a374607849230ca4d58b95b (diff)
downloaduml-history-81ea4710db70d7153c13ba78b7f8b2e8a1bf6143.tar.gz
Added a 'log' command, which dumps a bunch of text into the printk log.
-rw-r--r--arch/um/drivers/mconsole_kern.c16
-rw-r--r--arch/um/drivers/mconsole_user.c2
-rw-r--r--arch/um/include/mconsole.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 9164704..af28ca6 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -103,6 +103,19 @@ void mconsole_version(struct mc_request *req)
mconsole_reply(req, version, 0, 0);
}
+void mconsole_log(struct mc_request *req)
+{
+ int len;
+ char *ptr = req->request.data;
+
+ ptr += strlen("log");
+ while(isspace(*ptr)) ptr++;
+
+ len = ptr - req->request.data;
+ printk("%.*s", len, ptr);
+ mconsole_reply(req, "", 0, 0);
+}
+
#define UML_MCONSOLE_HELPTEXT \
"Commands: \n\
version - Get kernel version \n\
@@ -117,6 +130,7 @@ void mconsole_version(struct mc_request *req)
cad - invoke the Ctl-Alt-Del handler \n\
stop - pause the UML; it will do nothing until it receives a 'go' \n\
go - continue the UML after a 'stop' \n\
+ log <string> - make UML enter <string> into the kernel log\n\
"
void mconsole_help(struct mc_request *req)
@@ -305,7 +319,7 @@ int mconsole_init(void)
if(umid_file_name("mconsole", file, sizeof(file))) return(-1);
snprintf(mconsole_socket_name, sizeof(file), "%s", file);
- sock = create_unix_socket(file, sizeof(file));
+ sock = create_unix_socket(file, sizeof(file), 1);
if (sock < 0){
printk("Failed to initialize management console\n");
return(1);
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 11b09a9..f9fcbc6 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -28,6 +28,7 @@ static struct mconsole_command commands[] = {
{ "cad", mconsole_cad, 1 },
{ "stop", mconsole_stop, 0 },
{ "go", mconsole_go, 1 },
+ { "log", mconsole_log, 1 },
};
/* Initialized in mconsole_init, which is an initcall */
@@ -139,6 +140,7 @@ int mconsole_reply(struct mc_request *req, char *str, int err, int more)
memcpy(reply.data, str, len);
reply.data[len] = '\0';
total -= len;
+ str += len;
reply.len = len + 1;
len = sizeof(reply) + reply.len - sizeof(reply.data);
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h
index 7eea2fa..14ccb3a 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/mconsole.h
@@ -77,6 +77,7 @@ extern void mconsole_sysrq(struct mc_request *req);
extern void mconsole_cad(struct mc_request *req);
extern void mconsole_stop(struct mc_request *req);
extern void mconsole_go(struct mc_request *req);
+extern void mconsole_log(struct mc_request *req);
extern int mconsole_get_request(int fd, struct mc_request *req);
extern int mconsole_notify(char *sock_name, int type, const void *data,