dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0001-memfd-fix-configure-test.patch

Paolo Bonzini bfe7b8
From 758ec569df2da73a96bc1902b3524167d002c4c8 Mon Sep 17 00:00:00 2001
Paolo Bonzini bfe7b8
From: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini bfe7b8
Date: Tue, 28 Nov 2017 11:51:27 +0100
Paolo Bonzini bfe7b8
Subject: [PATCH] memfd: fix configure test
Paolo Bonzini bfe7b8
MIME-Version: 1.0
Paolo Bonzini bfe7b8
Content-Type: text/plain; charset=UTF-8
Paolo Bonzini bfe7b8
Content-Transfer-Encoding: 8bit
Paolo Bonzini bfe7b8
Paolo Bonzini bfe7b8
Recent glibc added memfd_create in sys/mman.h.  This conflicts with
Paolo Bonzini bfe7b8
the definition in util/memfd.c:
Paolo Bonzini bfe7b8
Paolo Bonzini bfe7b8
    /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
Paolo Bonzini bfe7b8
Paolo Bonzini bfe7b8
Fix the configure test, and remove the sys/memfd.h inclusion since the
Paolo Bonzini bfe7b8
file actually does not exist---it is a typo in the memfd_create(2) man
Paolo Bonzini bfe7b8
page.
Paolo Bonzini bfe7b8
Paolo Bonzini bfe7b8
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Paolo Bonzini bfe7b8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini bfe7b8
---
Paolo Bonzini bfe7b8
 configure    | 2 +-
Paolo Bonzini bfe7b8
 util/memfd.c | 4 +---
Paolo Bonzini bfe7b8
 2 files changed, 2 insertions(+), 4 deletions(-)
Paolo Bonzini bfe7b8
Paolo Bonzini bfe7b8
diff --git a/configure b/configure
Paolo Bonzini bfe7b8
index 6339befd8d..692ca970fd 100755
Paolo Bonzini bfe7b8
--- a/configure
Paolo Bonzini bfe7b8
+++ b/configure
Paolo Bonzini bfe7b8
@@ -3929,7 +3929,7 @@ fi
Paolo Bonzini bfe7b8
 # check if memfd is supported
Paolo Bonzini bfe7b8
 memfd=no
Paolo Bonzini bfe7b8
 cat > $TMPC << EOF
Paolo Bonzini bfe7b8
-#include <sys/memfd.h>
Paolo Bonzini bfe7b8
+#include <sys/mman.h>
Paolo Bonzini bfe7b8
 
Paolo Bonzini bfe7b8
 int main(void)
Paolo Bonzini bfe7b8
 {
Paolo Bonzini bfe7b8
diff --git a/util/memfd.c b/util/memfd.c
Paolo Bonzini bfe7b8
index 4571d1aba8..412e94a405 100644
Paolo Bonzini bfe7b8
--- a/util/memfd.c
Paolo Bonzini bfe7b8
+++ b/util/memfd.c
Paolo Bonzini bfe7b8
@@ -31,9 +31,7 @@
Paolo Bonzini bfe7b8
 
Paolo Bonzini bfe7b8
 #include "qemu/memfd.h"
Paolo Bonzini bfe7b8
 
Paolo Bonzini bfe7b8
-#ifdef CONFIG_MEMFD
Paolo Bonzini bfe7b8
-#include <sys/memfd.h>
Paolo Bonzini bfe7b8
-#elif defined CONFIG_LINUX
Paolo Bonzini bfe7b8
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
Paolo Bonzini bfe7b8
 #include <sys/syscall.h>
Paolo Bonzini bfe7b8
 #include <asm/unistd.h>
Paolo Bonzini bfe7b8
 
Paolo Bonzini bfe7b8
-- 
Paolo Bonzini bfe7b8
2.14.3
Paolo Bonzini bfe7b8