blob: 880cb980a0ef2ee7bdb57f6aa1478cfc7ec38e2c [file] [log] [blame]
Brad Bishopd5ae7d92018-06-14 09:52:03 -07001From 0c8af3f651a125d636a71d93bafd35ff5240431a Mon Sep 17 00:00:00 2001
Brad Bishop00111322018-04-01 22:23:53 -04002From: Paolo Bonzini <pbonzini@redhat.com>
3Date: Tue, 28 Nov 2017 11:51:27 +0100
4Subject: [PATCH] memfd: fix configure test
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Recent glibc added memfd_create in sys/mman.h. This conflicts with
10the definition in util/memfd.c:
11
12 /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
13
14Fix the configure test, and remove the sys/memfd.h inclusion since the
15file actually does not exist---it is a typo in the memfd_create(2) man
16page.
17
18Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Brad Bishopd5ae7d92018-06-14 09:52:03 -070019Upstream-Status: Backport
20Signed-off-by: Ross Burton <ross.burton@intel.com>
Brad Bishop00111322018-04-01 22:23:53 -040021Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
22---
23 configure | 2 +-
24 util/memfd.c | 4 +---
25 2 files changed, 2 insertions(+), 4 deletions(-)
26
27diff --git a/configure b/configure
Brad Bishopd5ae7d92018-06-14 09:52:03 -070028index b5312f4..ec12f36 100755
Brad Bishop00111322018-04-01 22:23:53 -040029--- a/configure
30+++ b/configure
Brad Bishopd5ae7d92018-06-14 09:52:03 -070031@@ -3920,7 +3920,7 @@ fi
Brad Bishop00111322018-04-01 22:23:53 -040032 # check if memfd is supported
33 memfd=no
34 cat > $TMPC << EOF
35-#include <sys/memfd.h>
36+#include <sys/mman.h>
37
38 int main(void)
39 {
40diff --git a/util/memfd.c b/util/memfd.c
Brad Bishopd5ae7d92018-06-14 09:52:03 -070041index 4571d1a..412e94a 100644
Brad Bishop00111322018-04-01 22:23:53 -040042--- a/util/memfd.c
43+++ b/util/memfd.c
44@@ -31,9 +31,7 @@
45
46 #include "qemu/memfd.h"
47
48-#ifdef CONFIG_MEMFD
49-#include <sys/memfd.h>
50-#elif defined CONFIG_LINUX
51+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
52 #include <sys/syscall.h>
53 #include <asm/unistd.h>
54