Skip to contentSkip to conversation

os-posix: include sys/mman.h

PATCH Superseded Paolo Bonzini 2 participants 3 messages Jun 6, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 os-posix: include sys/mman.h

qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous include of sys/mman.h.

---
 include/sysemu/os-posix.h | 1 +
 1 file changed, 1 insertion(+)
include/sysemu/os-posix.h +1 -0
index 07e3e5a..9c7dfdf 100644
@@ -26,6 +26,7 @@
 #ifndef QEMU_OS_POSIX_H
 #define QEMU_OS_POSIX_H
 
+#include <sys/mman.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
Signature · 1 line
2.5.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Paolo Bonzini

qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous include of sys/mman.h.

---
 include/sysemu/os-posix.h | 1 +
 1 file changed, 1 insertion(+)
include/sysemu/os-posix.h +1 -1
index 07e3e5a..9c7dfdf 100644
@@ -26,6 +26,7 @@
 #ifndef QEMU_OS_POSIX_H
 #define QEMU_OS_POSIX_H
 
+#include <sys/mman.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
--
Quoted 1 line

2.5.5

Did you discover this because something broke, or just through code inspection?

We could add mman.h to clean-includes and zap the other includes of it I guess.

thanks
-- PMM

#2 lore raw
Quoted 17 lines · Peter Maydell
Quoted 16 lines · Paolo Bonzini

qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous include of sys/mman.h.

---
 include/sysemu/os-posix.h | 1 +
 1 file changed, 1 insertion(+)
include/sysemu/os-posix.h +0 -0
index 07e3e5a..9c7dfdf 100644
@@ -26,6 +26,7 @@
 #ifndef QEMU_OS_POSIX_H
 #define QEMU_OS_POSIX_H
 
Quoted 9 lines
Quoted 6 lines
include/sysemu/os-posix.h +1 -1
+#include <sys/mman.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
--

2.5.5

Did you discover this because something broke, or just through code inspection?

sparse complained, but I don't think anything else breaks.

Quoted 4 lines

We could add mman.h to clean-includes and zap the other includes of it I guess.

Yup, good idea.

Thanks,

Paolo