Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1 | From 0c8af3f651a125d636a71d93bafd35ff5240431a Mon Sep 17 00:00:00 2001 |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 2 | From: Paolo Bonzini <pbonzini@redhat.com> |
| 3 | Date: Tue, 28 Nov 2017 11:51:27 +0100 |
| 4 | Subject: [PATCH] memfd: fix configure test |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | Recent glibc added memfd_create in sys/mman.h. This conflicts with |
| 10 | the 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 | |
| 14 | Fix the configure test, and remove the sys/memfd.h inclusion since the |
| 15 | file actually does not exist---it is a typo in the memfd_create(2) man |
| 16 | page. |
| 17 | |
| 18 | Cc: Marc-André Lureau <marcandre.lureau@redhat.com> |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 19 | Upstream-Status: Backport |
| 20 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 21 | Signed-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 | |
| 27 | diff --git a/configure b/configure |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 28 | index b5312f4..ec12f36 100755 |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 29 | --- a/configure |
| 30 | +++ b/configure |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 31 | @@ -3920,7 +3920,7 @@ fi |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 32 | # 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 | { |
| 40 | diff --git a/util/memfd.c b/util/memfd.c |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 41 | index 4571d1a..412e94a 100644 |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 42 | --- 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 | |