ia64/xen-unstable

view tools/internal/xi_read_console_ring.c @ 938:eaaf88bbc222

bitkeeper revision 1.597 (3fb26743975c08pGlW-UntXWf-IBnQ)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/br260/xeno.bk
author br260@labyrinth.cl.cam.ac.uk
date Wed Nov 12 17:00:51 2003 +0000 (2003-11-12)
parents 106bc1c68738
children 151801bd4e5e
line source
1 /*
2 * Usage: <executable> [-c]
3 */
5 #include "dom0_defs.h"
7 #define CONSOLE_RING_SIZE 16392
8 static char *argv0 = "read_console_ring";
10 static long read_console_ring(char *str, unsigned count)
11 {
12 int ret;
13 dom0_op_t op;
15 op.cmd = DOM0_READCONSOLE;
16 op.u.readconsole.str = str;
17 op.u.readconsole.count = count;
19 ret = do_dom0_op(&op);
20 if (ret > 0) {
21 *(str + ret) = '\0';
22 }
24 return ret;
25 }
27 int main(int argc, char **argv)
28 {
29 char str[CONSOLE_RING_SIZE];
31 if ( argv[0] != NULL )
32 argv0 = argv[0];
34 if ( argc > 2) {
35 fprintf(stderr, "Usage: %s [-r]\n", argv0);
36 return 1;
37 }
39 if ( read_console_ring(str, CONSOLE_RING_SIZE) < 0 ) {
40 printf("Read console ring error.\n");
41 printf("%s", str);
42 return 1;
43 }
45 printf("%s", str);
46 return 0;
47 }