[libvirt] [PATCH] build: fix use of mmap

Eric Blake eblake at redhat.com
Sat May 11 02:48:44 UTC 2013


Commit bfe7721d introduced a regression, but only on platforms
like FreeBSD that lack posix_fallocate and where mmap serves as
a nice fallback for safezero.

util/virfile.c: In function 'safezero':
util/virfile.c:837: error: 'PROT_READ' undeclared (first use in this function)

* src/util/virutil.c (includes): Move use of <sys/mman.h>...
* src/util/virfile.c (includes): ...to the file that uses mmap.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

Pushing under the build-breaker rule.

 src/util/virfile.c | 3 +++
 src/util/virutil.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 1491f27..a59d67d 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -39,6 +39,9 @@
 # include <mntent.h>
 #endif
 #include <stdlib.h>
+#if HAVE_MMAP
+# include <sys/mman.h>
+#endif

 #if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
 # include <linux/loop.h>
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 43814df..3c0a481 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -36,9 +36,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#if HAVE_MMAP
-# include <sys/mman.h>
-#endif
 #include <string.h>
 #include <termios.h>
 #include <locale.h>
-- 
1.8.1.4




More information about the libvir-list mailing list