mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
42 lines
967 B
C
42 lines
967 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <xenctrl.h>
|
|
|
|
int main(int argc, char * argv[])
|
|
{
|
|
unsigned long size;
|
|
xc_interface *xc_handle = xc_interface_open(0,0,0);
|
|
|
|
if ( xc_tbuf_get_size(xc_handle, &size) != 0 )
|
|
{
|
|
perror("Failure to get tbuf info from Xen. Guess size is 0");
|
|
printf("This may mean that tracing is not enabled in xen.\n");
|
|
}
|
|
else
|
|
{
|
|
printf("Current tbuf size: 0x%lx\n", size);
|
|
}
|
|
|
|
if (argc < 2)
|
|
exit(0);
|
|
|
|
size = atol(argv[1]);
|
|
|
|
if ( xc_tbuf_set_size(xc_handle, size) != 0 )
|
|
{
|
|
perror("set_size Hypercall failure");
|
|
exit(1);
|
|
}
|
|
printf("set_size succeeded.\n");
|
|
|
|
if (xc_tbuf_get_size(xc_handle, &size) != 0)
|
|
perror("Failure to get tbuf info from Xen."
|
|
" Tracing must be enabled first");
|
|
else
|
|
printf("New tbuf size: 0x%lx\n", size);
|
|
|
|
xc_interface_close(xc_handle);
|
|
return 0;
|
|
}
|