2010-07-22 14:54:34 +02:00
|
|
|
#include <xenctrl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
struct xen_sysctl_physinfo xphysinfo;
|
|
|
|
main()
|
|
|
|
{
|
2011-04-19 01:21:48 +02:00
|
|
|
#ifdef XENCTRL_HAS_XC_INTERFACE
|
|
|
|
xc_interface *handle = xc_interface_open(NULL, NULL, 0);
|
|
|
|
if (!handle) {
|
|
|
|
#else
|
2010-07-22 14:54:34 +02:00
|
|
|
int handle = xc_interface_open();
|
|
|
|
if (handle == -1) {
|
2011-04-19 01:21:48 +02:00
|
|
|
#endif
|
2010-07-22 14:54:34 +02:00
|
|
|
perror("xc_interface_open");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
if (xc_physinfo(handle, &xphysinfo)) {
|
|
|
|
perror("xc_physinfo");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
printf("%lld", xphysinfo.free_pages);
|
|
|
|
return 0;
|
|
|
|
}
|