1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <errno.h>
4 #include <xenctrl.h>
5 
main(int argc,char * argv[])6 int main(int argc, char * argv[])
7 {
8     unsigned long size;
9     xc_interface *xc_handle = xc_interface_open(0,0,0);
10 
11     if ( xc_tbuf_get_size(xc_handle, &size) != 0 )
12     {
13         perror("Failure to get tbuf info from Xen. Guess size is 0");
14         printf("This may mean that tracing is not enabled in xen.\n");
15     }
16     else
17     {
18         printf("Current tbuf size: 0x%lx\n", size);
19     }
20 
21     if (argc < 2)
22         exit(0);
23 
24     size = atol(argv[1]);
25 
26     if ( xc_tbuf_set_size(xc_handle, size) != 0 )
27     {
28         perror("set_size Hypercall failure");
29         exit(1);
30     }
31     printf("set_size succeeded.\n");
32 
33     if (xc_tbuf_get_size(xc_handle, &size) != 0)
34         perror("Failure to get tbuf info from Xen."
35                " Tracing must be enabled first");
36     else
37         printf("New tbuf size: 0x%lx\n", size);
38 
39     xc_interface_close(xc_handle);
40     return 0;
41 }
42