Skip to contentSkip to conversation

Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems

PATCH In review Khem Raj 3 participants 3 messages Mar 22, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems

linux only wires MAP_SYNC for architectures which include asm-generic/mman-common.h and mips is one such architecture which is not including this file via linux/mman.h, therefore as a fall back these constants should be defined for such architectures on Linux as well.

This fixes build on mips/musl/linux

Cc Zhang Yi <[email protected]>
Cc Michael S. Tsirkin <[email protected]>

---
v2: Improve commit message

 util/mmap-alloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
util/mmap-alloc.c +7 -3
index 893d864354..86d3cda248 100644
@@ -10,14 +10,18 @@
  * later.  See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #ifdef CONFIG_LINUX
 #include <linux/mman.h>
-#else  /* !CONFIG_LINUX */
+#endif  /* CONFIG_LINUX */
+
+#ifndef MAP_SYNC
 #define MAP_SYNC              0x0
+#endif /* MAP_SYNC */
+#ifndef MAP_SHARED_VALIDATE
 #define MAP_SHARED_VALIDATE   0x0
-#endif /* CONFIG_LINUX */
+#endif /* MAP_SHARED_VALIDATE */
 
-#include "qemu/osdep.h"
 #include "qemu/mmap-alloc.h"
 #include "qemu/host-utils.h"
 #include "qemu/cutils.h"
Signature · 1 line
2.35.1
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Khem Raj

linux only wires MAP_SYNC for architectures which include asm-generic/mman-common.h and mips is one such architecture which is not including this file via linux/mman.h, therefore as a fall back these constants should be defined for such architectures on Linux as well.

This fixes build on mips/musl/linux

Cc Zhang Yi <[email protected]>
Cc Michael S. Tsirkin <[email protected]>

who's merging this? mips tree?

Quoted 34 lines

---
v2: Improve commit message

 util/mmap-alloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
util/mmap-alloc.c +7 -3
index 893d864354..86d3cda248 100644
@@ -10,14 +10,18 @@
  * later.  See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #ifdef CONFIG_LINUX
 #include <linux/mman.h>
-#else  /* !CONFIG_LINUX */
+#endif  /* CONFIG_LINUX */
+
+#ifndef MAP_SYNC
 #define MAP_SYNC              0x0
+#endif /* MAP_SYNC */
+#ifndef MAP_SHARED_VALIDATE
 #define MAP_SHARED_VALIDATE   0x0
-#endif /* CONFIG_LINUX */
+#endif /* MAP_SHARED_VALIDATE */
 
-#include "qemu/osdep.h"
 #include "qemu/mmap-alloc.h"
 #include "qemu/host-utils.h"
 #include "qemu/cutils.h"
Signature · 1 line
2.35.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Khem Raj
Quoted 6 lines · Khem Raj

linux only wires MAP_SYNC for architectures which include asm-generic/mman-common.h and mips is one such architecture which is not including this file via linux/mman.h, therefore as a fall back these constants should be defined for such architectures on Linux as well.

Quoted 7 lines

This fixes build on mips/musl/linux

Cc Zhang Yi<[email protected]>
Cc Michael S. Tsirkin<[email protected]>

---
v2: Improve commit message

r~