#include #include #include #include int main(int argc, char** argv) { int ret, i; uint32_t refs[2] = {0}; void* pages; xc_gntshr *h = xc_gntshr_open(NULL, 0); if (h == NULL) { perror("xc_gntshr_open"); exit (1); } for(i=0; i<10000; i++) { pages = xc_gntshr_share_pages(h, 0, 2, refs, 1); if (pages == NULL) { fprintf(stderr, "xc_gntshr_share_pages failed at the %dth iteration.\n", i); perror("xc_gntshr_share_pages"); exit (1); } if(xc_gntshr_munmap(h, pages, 2) != 0) { perror("xc_gntshr_munmap"); exit (1); } } xc_gntshr_close(h); }