]> xenbits.xensource.com Git - rumpuser-xen.git/commitdiff
add optional debug prints for cases where mmap "emulation" fails
authorAntti Kantee <pooka@iki.fi>
Thu, 15 Jan 2015 11:27:21 +0000 (11:27 +0000)
committerAntti Kantee <pooka@iki.fi>
Thu, 15 Jan 2015 11:27:21 +0000 (11:27 +0000)
lib/emul.c

index a5424f40399fe24b0ed3cbed61dd6f6cbcd5c832..e9bc299e4b89c828c9c6dddfa85a722f13f0062e 100644 (file)
 #include "netbsd_init.h"
 #include "rumpconfig.h"
 
+#ifdef RUMPRUN_MMAP_DEBUG
+#define MMAP_PRINTF(x) printf x
+#else
+#define MMAP_PRINTF(x)
+#endif
+
 void *
 mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off)
 {
@@ -31,6 +37,7 @@ mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off)
        int error;
 
        if (fd != -1 && prot != PROT_READ) {
+               MMAP_PRINTF(("mmap: trying to r/w map a file. failing!\n"));
                errno = ENOTSUP;
                return MAP_FAILED;
        }
@@ -44,6 +51,7 @@ mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off)
                return v;
 
        if ((nn = pread(fd, v, len, off)) == -1) {
+               MMAP_PRINTF(("mmap: failed to populate r/o file mapping!\n"));
                error = errno;
                free(v);
                errno = error;