diff -Naur orig/arch/um/drivers/mconsole_kern.c linux-2.4.24/arch/um/drivers/mconsole_kern.c --- orig/arch/um/drivers/mconsole_kern.c 2004-03-27 02:00:28.000000000 -0700 +++ linux-2.4.24/arch/um/drivers/mconsole_kern.c 2004-03-27 02:10:11.000000000 -0700 @@ -216,6 +216,7 @@ sysrq - Performs the SysRq action controlled by the letter \n\ cad - invoke the Ctl-Alt-Del handler \n\ stop - pause the UML; it will do nothing until it receives a 'go' \n\ + status - check to see if the UML is stopped or running\n\ go - continue the UML after a 'stop' \n\ log - make UML enter into the kernel log\n\ proc - returns the contents of the UML's /proc/\n\ @@ -251,15 +252,39 @@ mconsole_reply(req, "Not stopped", 1, 0); } +void mconsole_status(struct mc_request *req) +{ + /* CurrentStatus of 'R' indicates running */ + /* CurrentStatus of 'S' indicates a stopped UML */ + static char CurrentStatus = 'R'; + + if (req->cmd->handler == mconsole_status) + { + if (CurrentStatus == 'S') mconsole_reply(req, "Stopped", 0, 0); + else mconsole_reply(req, "Running", 0, 0); + } + else if (req->cmd->handler == mconsole_stop) + { + CurrentStatus = 'S'; + } + else if (req->cmd->handler == mconsole_go) + { + CurrentStatus = 'R'; + } + else mconsole_reply(req, "", 1, 0); +} + void mconsole_stop(struct mc_request *req) { deactivate_fd(req->originating_fd, MCONSOLE_IRQ); os_set_fd_block(req->originating_fd, 1); + mconsole_status(req); /* change the status to stopped */ mconsole_reply(req, "", 0, 0); while(mconsole_get_request(req->originating_fd, req)){ if(req->cmd->handler == mconsole_go) break; (*req->cmd->handler)(req); } + mconsole_status(req); /* change the status back to running */ os_set_fd_block(req->originating_fd, 0); reactivate_fd(req->originating_fd, MCONSOLE_IRQ); mconsole_reply(req, "", 0, 0); diff -Naur orig/arch/um/drivers/mconsole_user.c linux-2.4.24/arch/um/drivers/mconsole_user.c --- orig/arch/um/drivers/mconsole_user.c 2004-03-27 02:00:28.000000000 -0700 +++ linux-2.4.24/arch/um/drivers/mconsole_user.c 2004-03-27 02:11:09.000000000 -0700 @@ -28,6 +28,7 @@ { "cad", mconsole_cad, MCONSOLE_INTR }, { "stop", mconsole_stop, MCONSOLE_PROC }, { "go", mconsole_go, MCONSOLE_INTR }, + { "status", mconsole_status, MCONSOLE_PROC }, { "log", mconsole_log, MCONSOLE_INTR }, { "proc", mconsole_proc, MCONSOLE_PROC }, }; diff -Naur orig/arch/um/include/mconsole.h linux-2.4.24/arch/um/include/mconsole.h --- orig/arch/um/include/mconsole.h 2004-03-27 02:00:28.000000000 -0700 +++ linux-2.4.24/arch/um/include/mconsole.h 2004-03-27 02:11:30.000000000 -0700 @@ -79,6 +79,7 @@ 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_status(struct mc_request *req); extern void mconsole_log(struct mc_request *req); extern void mconsole_proc(struct mc_request *req);