diff options
author | br260@labyrinth.cl.cam.ac.uk <br260@labyrinth.cl.cam.ac.uk> | 2003-11-12 17:00:46 +0000 |
---|---|---|
committer | br260@labyrinth.cl.cam.ac.uk <br260@labyrinth.cl.cam.ac.uk> | 2003-11-12 17:00:46 +0000 |
commit | ca4357e5aa50d4620d20cebaf1a80b579dd997c4 (patch) | |
tree | 7cd0a8f44cfc7552ba9668c4f20c4df1bd7f5695 /tools/internal | |
parent | 534df3bba622b5698d4339a219854ef52bb91c48 (diff) | |
download | xen-ca4357e5aa50d4620d20cebaf1a80b579dd997c4.tar.gz xen-ca4357e5aa50d4620d20cebaf1a80b579dd997c4.tar.bz2 xen-ca4357e5aa50d4620d20cebaf1a80b579dd997c4.zip |
bitkeeper revision 1.593.1.1 (3fb2673ecxanxs8T80yNhChH3vMCyA)
add new domain 0 operation to read console ring in Xen
Diffstat (limited to 'tools/internal')
-rw-r--r-- | tools/internal/Makefile | 1 | ||||
-rw-r--r-- | tools/internal/xi_read_console_ring.c | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tools/internal/Makefile b/tools/internal/Makefile index 3979cace5b..1a225c0d88 100644 --- a/tools/internal/Makefile +++ b/tools/internal/Makefile @@ -11,6 +11,7 @@ TARGETS = xi_create xi_start xi_stop xi_destroy xi_build TARGETS += xi_phys_grant xi_list xi_save_linux xi_restore_linux TARGETS += xi_sched_global xi_sched_domain xi_usage xi_vif_params TARGETS += xi_vbd_create xi_vbd_add xi_vbd_list xi_vbd_info +TARGETS += xi_read_console_ring INSTALL = $(TARGETS) xi_vifinit xi_helper all: check-for-zlib $(TARGETS) diff --git a/tools/internal/xi_read_console_ring.c b/tools/internal/xi_read_console_ring.c new file mode 100644 index 0000000000..9f28823c20 --- /dev/null +++ b/tools/internal/xi_read_console_ring.c @@ -0,0 +1,47 @@ +/* + * Usage: <executable> [-c] + */ + +#include "dom0_defs.h" + +#define CONSOLE_RING_SIZE 16392 +static char *argv0 = "read_console_ring"; + +static long read_console_ring(char *str, unsigned count) +{ + int ret; + dom0_op_t op; + + op.cmd = DOM0_READCONSOLE; + op.u.readconsole.str = str; + op.u.readconsole.count = count; + + ret = do_dom0_op(&op); + if (ret > 0) { + *(str + ret) = '\0'; + } + + return ret; +} + +int main(int argc, char **argv) +{ + char str[CONSOLE_RING_SIZE]; + + if ( argv[0] != NULL ) + argv0 = argv[0]; + + if ( argc > 2) { + fprintf(stderr, "Usage: %s [-r]\n", argv0); + return 1; + } + + if ( read_console_ring(str, CONSOLE_RING_SIZE) < 0 ) { + printf("Read console ring error.\n"); + printf("%s", str); + return 1; + } + + printf("%s", str); + return 0; +} |