]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
libxencall: Improve linux syscall error messages
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 15 Oct 2018 14:22:53 +0000 (15:22 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 30 Oct 2018 17:03:31 +0000 (17:03 +0000)
Make the bufdev and non-bufdev messages distinct, and always print the
non-constant argument (ie, the size).

This assists diagnosis.

CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libs/call/linux.c

index d8a6306e04719947ad64ce0074569ce5b65e9f65..51fa4899ebf648bb2267363f89ea76420984b085 100644 (file)
@@ -93,7 +93,8 @@ static void *alloc_pages_bufdev(xencall_handle *xcall, size_t npages)
              xcall->buf_fd, 0);
     if ( p == MAP_FAILED )
     {
-        PERROR("alloc_pages: mmap failed");
+        PERROR("alloc_pages: mmap (,%zu*%lu,...) [bufdev] failed",
+               npages, (unsigned long)PAGE_SIZE);
         p = NULL;
     }
 
@@ -110,7 +111,7 @@ static void *alloc_pages_nobufdev(xencall_handle *xcall, size_t npages)
     p = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_LOCKED, -1, 0);
     if ( p == MAP_FAILED )
     {
-        PERROR("alloc_pages: mmap failed");
+        PERROR("alloc_pages: mmap(,%zu,...) [nobufdev] failed", size);
         return NULL;
     }
 
@@ -119,7 +120,8 @@ static void *alloc_pages_nobufdev(xencall_handle *xcall, size_t npages)
     rc = madvise(p, npages * PAGE_SIZE, MADV_DONTFORK);
     if ( rc < 0 )
     {
-        PERROR("alloc_pages: madvise failed");
+        PERROR("alloc_pages: madvise (,%zu*%lu,) [nobufdev] failed",
+               npages, (unsigned long)PAGE_SIZE);
         goto out;
     }