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.

50 lines
1.4 KiB

  1. From e1e0a76305927290d75b4aae56f1ed89d83da741 Mon Sep 17 00:00:00 2001
  2. From: Yousong Zhou <yszhou4tech@gmail.com>
  3. Date: Mon, 30 Mar 2020 12:48:58 +0800
  4. Subject: [PATCH] util/mmap-alloc: fix missing MAP_SYNC
  5. Quote musl-libc commit 9b57db3f958 ("add MAP_SYNC and
  6. MAP_SHARED_VALIDATE from linux v4.15")
  7. > for synchronous page faults, new in linux commit
  8. > 1c9725974074a047f6080eecc62c50a8e840d050 and
  9. > b6fb293f2497a9841d94f6b57bd2bb2cd222da43
  10. > note that only targets that use asm-generic/mman.h have this new
  11. > flag defined, so undef it on other targets (mips*, powerpc*).
  12. Fixes 119906afa5c ("util/mmap-alloc: support MAP_SYNC in
  13. qemu_ram_mmap()")
  14. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
  15. ---
  16. util/mmap-alloc.c | 10 +++++++---
  17. 1 file changed, 7 insertions(+), 3 deletions(-)
  18. diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
  19. index 27dcccd8ec..e133e38d21 100644
  20. --- a/util/mmap-alloc.c
  21. +++ b/util/mmap-alloc.c
  22. @@ -12,9 +12,6 @@
  23. #ifdef CONFIG_LINUX
  24. #include <linux/mman.h>
  25. -#else /* !CONFIG_LINUX */
  26. -#define MAP_SYNC 0x0
  27. -#define MAP_SHARED_VALIDATE 0x0
  28. #endif /* CONFIG_LINUX */
  29. #include "qemu/osdep.h"
  30. @@ -27,6 +24,13 @@
  31. #include <sys/vfs.h>
  32. #endif
  33. +#ifndef MAP_SYNC
  34. +#define MAP_SYNC 0x0
  35. +#endif
  36. +#ifndef MAP_SHARED_VALIDATE
  37. +#define MAP_SHARED_VALIDATE 0x0
  38. +#endif
  39. +
  40. size_t qemu_fd_getpagesize(int fd)
  41. {
  42. #ifdef CONFIG_LINUX