xenfreepages.c 339 B

123456789101112131415161718
  1. #include <xenctrl.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. struct xen_sysctl_physinfo xphysinfo;
  5. main()
  6. {
  7. int handle = xc_interface_open();
  8. if (handle == -1) {
  9. perror("xc_interface_open");
  10. exit(1);
  11. }
  12. if (xc_physinfo(handle, &xphysinfo)) {
  13. perror("xc_physinfo");
  14. exit(1);
  15. }
  16. printf("%lld", xphysinfo.free_pages);
  17. return 0;
  18. }