You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.3 KiB

From e1e0a76305927290d75b4aae56f1ed89d83da741 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Mon, 30 Mar 2020 12:48:58 +0800
Subject: [PATCH] util/mmap-alloc: fix missing MAP_SYNC
Quote musl-libc commit 9b57db3f958 ("add MAP_SYNC and
MAP_SHARED_VALIDATE from linux v4.15")
> for synchronous page faults, new in linux commit
> 1c9725974074a047f6080eecc62c50a8e840d050 and
> b6fb293f2497a9841d94f6b57bd2bb2cd222da43
> note that only targets that use asm-generic/mman.h have this new
> flag defined, so undef it on other targets (mips*, powerpc*).
Fixes 119906afa5c ("util/mmap-alloc: support MAP_SYNC in
qemu_ram_mmap()")
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
util/mmap-alloc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -12,9 +12,6 @@
#ifdef CONFIG_LINUX
#include <linux/mman.h>
-#else /* !CONFIG_LINUX */
-#define MAP_SYNC 0x0
-#define MAP_SHARED_VALIDATE 0x0
#endif /* CONFIG_LINUX */
#include "qemu/osdep.h"
@@ -27,6 +24,13 @@
#include <sys/vfs.h>
#endif
+#ifndef MAP_SYNC
+#define MAP_SYNC 0x0
+#endif
+#ifndef MAP_SHARED_VALIDATE
+#define MAP_SHARED_VALIDATE 0x0
+#endif
+
size_t qemu_fd_getpagesize(int fd)
{
#ifdef CONFIG_LINUX