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

  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. --- a/util/mmap-alloc.c
  19. +++ b/util/mmap-alloc.c
  20. @@ -12,9 +12,6 @@
  21. #ifdef CONFIG_LINUX
  22. #include <linux/mman.h>
  23. -#else /* !CONFIG_LINUX */
  24. -#define MAP_SYNC 0x0
  25. -#define MAP_SHARED_VALIDATE 0x0
  26. #endif /* CONFIG_LINUX */
  27. #include "qemu/osdep.h"
  28. @@ -27,6 +24,13 @@
  29. #include <sys/vfs.h>
  30. #endif
  31. +#ifndef MAP_SYNC
  32. +#define MAP_SYNC 0x0
  33. +#endif
  34. +#ifndef MAP_SHARED_VALIDATE
  35. +#define MAP_SHARED_VALIDATE 0x0
  36. +#endif
  37. +
  38. size_t qemu_fd_getpagesize(int fd)
  39. {
  40. #ifdef CONFIG_LINUX