Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
PATCH 1/1 Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures which include asm-generic/mman.h and mips/powerpc are not including this file in linux/mman.h, therefore these should be defined for such architectures on Linux as well. This fixes build on mips/musl/linux
--- util/mmap-alloc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
util/mmap-alloc.c +7 -3
@@ -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
Quoted 4 lines · Khem Raj
linux only wires
MAP_SYNCandMAP_SHARED_VALIDATEfor architectures which includeasm-generic/mman.hand mips/powerpc are not including this file inlinux/mman.h, therefore these should be defined for such architectures on Linux as well.
This is not precisely correct.
MAP_SHARED_VALIDATE is defined in <linux/mman.h> for all architectures.
MAP_SYNC is defined in <asm-generic/mman-common.h>, which is included by powerpc <asm/mman.h>. But you are correct that this is missing for mips.
Quoted 9 lines
util/mmap-alloc.c +2
-1@@ -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 */
util/mmap-alloc.c line 20
Quoted 10 lines
util/mmap-alloc.c +5
-2+ +#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"
The patch is correct, just need to fix the description.
r~
Michael S. Tsirkin
Acked-byQuoted 6 lines · Richard Henderson
Quoted 4 lines · Khem Raj
linux only wires
MAP_SYNCandMAP_SHARED_VALIDATEfor architectures which includeasm-generic/mman.hand mips/powerpc are not including this file inlinux/mman.h, therefore these should be defined for such architectures on Linux as well.
Quoted 6 lines
This is not precisely correct.
MAP_SHARED_VALIDATEis defined in <linux/mman.h> for all architectures.
MAP_SYNCis defined in <asm-generic/mman-common.h>, which is included by powerpc <asm/mman.h>. But you are correct that this is missing for mips.
OK, sounds like the commit log should be tweaked and the patch reposted. The patch itself looks ok to me
mips tree I guess?
Quoted 23 lines
Quoted 7 lines
util/mmap-alloc.c +1
-1@@ -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 */ util/mmap-alloc.c line 18
Quoted 10 lines
util/mmap-alloc.c +6
-2+#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" The patch is correct, just need to fix the description.
Reviewed-by Richard Henderson <[email protected]>r~