ia64/xen-unstable

view tools/misc/xc_shadow.c @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents 3233e7ecfa9f
children 06d84bf87159
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
2 ****************************************************************************
3 * (C) 2005 - Rolf Neugebauer - Intel Research Cambridge
4 ****************************************************************************
5 *
6 * File: xc_shadow.c
7 * Author: Rolf Neugebauer (rolf.neugebauer@intel.com)
8 * Date: Mar 2005
9 *
10 * Description:
11 */
14 #include <xenctrl.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <sys/mman.h>
18 #include <errno.h>
19 #include <string.h>
21 void usage()
22 {
23 printf("xc_shadow: -[0|1|2]\n");
24 printf(" set shadow mode\n");
25 exit(0);
26 }
28 int main(int argc, char *argv[])
29 {
30 int xc_handle;
31 int mode;
33 if ( argc > 1 )
34 {
35 char *p = argv[1];
36 if (*p++ == '-') {
37 if (*p == '1')
38 mode = 1;
39 else if (*p == '2')
40 mode = 2;
41 else if (*p == '0')
42 mode = 0;
43 else
44 usage();
45 } else
46 usage();
47 }
48 else
49 usage();
51 if ( (xc_handle = xc_interface_open()) == -1 )
52 {
53 fprintf(stderr, "Error opening xc interface: %d (%s)\n",
54 errno, strerror(errno));
55 return 1;
56 }
58 if ( xc_shadow_control(xc_handle,
59 0,
60 mode,
61 NULL,
62 0,
63 NULL) < 0 )
64 {
65 fprintf(stderr, "Error reseting performance counters: %d (%s)\n",
66 errno, strerror(errno));
67 return 1;
68 }
69 return 0;
70 }