os-posix: include sys/mman.h
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Jun 2016 11:57:39 +0000 (13:57 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 16 Jun 2016 16:39:03 +0000 (18:39 +0200)
qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check
is bogus without a previous inclusion of sys/mman.h.  Include it in
sysemu/os-posix.h and remove it from everywhere else.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
54 files changed:
audio/ossaudio.c
block/qcow2-cache.c
bsd-user/elfload.c
bsd-user/main.c
bsd-user/mmap.c
bsd-user/syscall.c
contrib/ivshmem-server/ivshmem-server.c
exec.c
hw/block/xen_disk.c
hw/char/xen_console.c
hw/display/xenfb.c
hw/i386/kvm/pci-assign.c
hw/misc/ivshmem.c
hw/misc/pc-testdev.c
hw/net/xen_nic.c
hw/usb/xen-usb.c
hw/vfio/common.c
hw/vfio/pci.c
hw/virtio/virtio-balloon.c
hw/xen/xen_backend.c
hw/xen/xen_pt_msi.c
include/qemu/osdep.h
include/sysemu/os-posix.h
kvm-all.c
linux-user/elfload.c
linux-user/flatload.c
linux-user/main.c
linux-user/mmap.c
linux-user/strace.c
linux-user/syscall.c
migration/postcopy-ram.c
net/netmap.c
os-posix.c
qemu-char.c
scripts/clean-includes
target-arm/kvm.c
target-arm/kvm32.c
target-arm/kvm64.c
target-i386/kvm.c
target-mips/kvm.c
target-ppc/kvm.c
target-s390x/kvm.c
tests/i440fx-test.c
tests/ivshmem-test.c
tests/postcopy-test.c
tests/vhost-user-bridge.c
tests/vhost-user-test.c
translate-all.c
util/memfd.c
util/mmap-alloc.c
util/osdep.c
util/oslib-posix.c
xen-hvm.c
xen-mapcache.c

index a0d9cda1ec5cd7f3a2846e7bd4ce2effc949ac18..0edd7ea5fedd57f67468f46795a3f145e05128e5 100644 (file)
@@ -22,7 +22,6 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/soundcard.h>
 #include "qemu-common.h"
index 208a060421dbe85c9c06dbddddfa3fe682048a9f..580631c3d89865b6ce78e437a5c16d63ba2b66c6 100644 (file)
 
 /* Needed for CONFIG_MADVISE */
 #include "qemu/osdep.h"
-
-#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE)
-#include <sys/mman.h>
-#endif
-
 #include "block/block_int.h"
 #include "qemu-common.h"
 #include "qcow2.h"
index 898ee05472e218ad33a4a91acaf3d225c0000e3d..41a1309296c34e2c8036f1690aaad4e44e41856e 100644 (file)
@@ -1,7 +1,6 @@
 /* This is the Linux kernel elf-loading code, ported into user space */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "qemu.h"
 #include "disas/disas.h"
index 9f592be96ff8cfcd06da96fb64f2081bbc0cb2dc..abe9a26f9bc4657e406f3017accaebc8660b875d 100644 (file)
@@ -18,7 +18,6 @@
  */
 #include "qemu/osdep.h"
 #include <machine/trap.h>
-#include <sys/mman.h>
 
 #include "qemu.h"
 #include "qemu/path.h"
index 6ab533470212166062a99f5199199654b283c2de..610f91b28584ad4dddbee6f58d651924e3bf14a6 100644 (file)
@@ -17,7 +17,6 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "qemu.h"
 #include "qemu-common.h"
index 47cf865a3234eb366c833536bd56613d725e89ad..a9fe8693c144301f7626fb4e7352804927a55d14 100644 (file)
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
 #include "qemu/path.h"
-#include <sys/mman.h>
 #include <sys/syscall.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
index bf4ee0b2e2f99a84758c403791ba3ff33944b005..e2f295bd439e5a500939527f8a524bd36da552bc 100644 (file)
@@ -10,7 +10,6 @@
 #include "qemu/host-utils.h"
 #include "qemu/sockets.h"
 
-#include <sys/mman.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 
diff --git a/exec.c b/exec.c
index 4f3818c561f37a9bc84d00128c9d1084c75c20b1..0122ef76de5d8331d6892e5f60657469294eca03 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #ifndef _WIN32
-#include <sys/mman.h>
 #endif
 
 #include "qemu/cutils.h"
index cf57814fb677c5acc653424ce8c66c9a1c16c767..90aca7312112e2297038acd507f2bd022eb7d76c 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/uio.h>
 
 #include "hw/hw.h"
index cbf1dccbb159b9352acfab58808bad8044206e5c..83108b0bdb45c4291c81763ad357473c24e8c5ab 100644 (file)
@@ -22,7 +22,6 @@
 #include "qemu/osdep.h"
 #include <sys/select.h>
 #include <termios.h>
-#include <sys/mman.h>
 
 #include "hw/hw.h"
 #include "sysemu/char.h"
index 570b0977c3ee7781f975f81bf49085ef3efdc55c..46b7d5eded3d38970db2266356caa77779ec166f 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "hw/hw.h"
 #include "ui/console.h"
index db2cbd200241efd8878225af6df35460f0993be5..dd9e73b6f5e8d96cd7051c55b19f46940c7a0f6f 100644 (file)
@@ -22,7 +22,6 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include <sys/mman.h>
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "qemu/error-report.h"
index 90be9f76174f46e526ffb80101794966854e95ca..c4dde3a52e7fd8d7eef472bbdc4d9316b70cb33a 100644 (file)
@@ -36,8 +36,6 @@
 
 #include "hw/misc/ivshmem.h"
 
-#include <sys/mman.h>
-
 #define PCI_VENDOR_ID_IVSHMEM   PCI_VENDOR_ID_REDHAT_QUMRANET
 #define PCI_DEVICE_ID_IVSHMEM   0x1110
 
index 086893dcca962d24c6aa8b980327088e28b6af91..b81d820084edef3c6b8df9be05f90c06d8f9b6d2 100644 (file)
@@ -36,9 +36,6 @@
 */
 
 #include "qemu/osdep.h"
-#if defined(CONFIG_POSIX)
-#include <sys/mman.h>
-#endif
 #include "hw/hw.h"
 #include "hw/qdev.h"
 #include "hw/isa/isa.h"
index 7281730d94437bed5d00e680753191b25b8db016..0b4ddae48cedb984ac1708cada75e47887ec7ac8 100644 (file)
@@ -22,7 +22,6 @@
 #include "qemu/osdep.h"
 #include <sys/socket.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/wait.h>
 
 #include "hw/hw.h"
index 8fa47edd9a6e3278cb8e3c238d85fe430031da16..0fd34c62c4f55b62d3380812ec128dba1481a9cc 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "qemu/osdep.h"
 #include <libusb.h>
-#include <sys/mman.h>
 
 #include "qemu-common.h"
 #include "qemu/config-file.h"
index e51ed3a348d885e3528a33538294fee020b12e56..5ff5e9220ac0902ec91bdc6d469309c096dcc177 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <linux/vfio.h>
 
 #include "hw/vfio/vfio-common.h"
index deab0c601a82a5910570ff551ab2e0e6f1d9daaf..53b87b76ea04c996c14c966c40847d2c14bc6109 100644 (file)
@@ -21,7 +21,6 @@
 #include "qemu/osdep.h"
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
index 8c15e094701861c18f6fb19cbedcc451c2a9ea6c..557d3f9e0c2c85ede44ded5681b1345902c16c58 100644 (file)
 #include "qapi-event.h"
 #include "trace.h"
 
-#if defined(__linux__)
-#include <sys/mman.h>
-#endif
-
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 
index c63f9df38b261e92ab08677bc6dbe69eb4f0f69c..e7ce724567148a67369017f54ae63893848da1d6 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 #include <sys/signal.h>
 
 #include "hw/hw.h"
index 9a16f2bff1d32485556551ebdfed6f319b2a6c31..62add0639f2408924f6fa7a56761bfb4cac25bc4 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "hw/xen/xen_backend.h"
 #include "xen_pt.h"
index 693769403fac244b91691eb9236672376be4317b..e63da2831ae8e9e6e99be7f7556bb44f3680bdde 100644 (file)
@@ -197,8 +197,6 @@ void qemu_anon_ram_free(void *ptr, size_t size);
 
 #if defined(CONFIG_MADVISE)
 
-#include <sys/mman.h>
-
 #define QEMU_MADV_WILLNEED  MADV_WILLNEED
 #define QEMU_MADV_DONTNEED  MADV_DONTNEED
 #ifdef MADV_DONTFORK
index 07e3e5ae9b13e7d39f6e4c444a4dc315ce5e3378..9c7dfdfbec6961902fd894cf4683cf28532d760a 100644 (file)
@@ -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>
index fbd2d93188f648d8acff196e1df8d29aa480d4a7..71af270e31bd34ea7e055da112edc0694237f11c 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -15,7 +15,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include <linux/kvm.h>
 
index bb2558f2841a4ef1fa092fea0c01229b989d4d43..f807baf38965a55fcb1f058ebf0fdd64aeb75164 100644 (file)
@@ -2,7 +2,6 @@
 #include "qemu/osdep.h"
 #include <sys/param.h>
 
-#include <sys/mman.h>
 #include <sys/resource.h>
 
 #include "qemu.h"
index f9139c399acebf0dea23576fd8a2c514f579686a..48ad1c5e9e3ee17062680c036f9e025f57e93b06 100644 (file)
@@ -34,7 +34,6 @@
 /****************************************************************************/
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "qemu.h"
 #include "flat.h"
index f8a8764ae97a69b21ab4c1148b60835c8c517469..b9a4e0ea45acf951eaa022b1b6c456291fded9d8 100644 (file)
@@ -18,7 +18,6 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-version.h"
-#include <sys/mman.h>
 #include <sys/syscall.h>
 #include <sys/resource.h>
 
index 3519147bce91219e84181b61725cce1126a0492f..c4371d943a85664f2f450c9d4ac72d93e2157cff 100644 (file)
@@ -17,7 +17,6 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 #include <linux/mman.h>
 #include <linux/unistd.h>
 
index c5980a128cb446749be5f018e24b8edc088332f6..4046b8170577cdeb3cf1fa992d34351c18aeec97 100644 (file)
@@ -5,7 +5,6 @@
 #include <sys/shm.h>
 #include <sys/select.h>
 #include <sys/mount.h>
-#include <sys/mman.h>
 #include <sched.h>
 #include "qemu.h"
 
index 71ccbd9c5e30bc7e101a6df1bcafa05ea815f100..1c17b741c268146ed543cd80a8c8d2da5ce186cf 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/personality.h>
 #include <sys/prctl.h>
 #include <sys/resource.h>
-#include <sys/mman.h>
 #include <sys/swap.h>
 #include <linux/capability.h>
 #include <sched.h>
index 47250b675db0340941dc9926ff86dae2d4cd3cc3..abe8c60a903f69b32ddf7980974c9731e061eea6 100644 (file)
@@ -51,7 +51,6 @@ struct PostcopyDiscardState {
 #if defined(__linux__)
 
 #include <poll.h>
-#include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/syscall.h>
 #include <asm/types.h> /* for __u64 */
index 6cc0db5ee1cfbd124b9483e02cd45b320685e874..64967b947ee07d4d20daee388183177c345b75c8 100644 (file)
@@ -26,7 +26,6 @@
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <net/if.h>
-#include <sys/mman.h>
 #define NETMAP_WITH_LIBS
 #include <net/netmap.h>
 #include <net/netmap_user.h>
index 107fde38bfddfab87aaa98a315d89e4c5fecb0dc..3755265582514fff6f820a651d808140bb53ba51 100644 (file)
@@ -26,7 +26,6 @@
 #include "qemu/osdep.h"
 #include <sys/wait.h>
 /*needed for MAP_POPULATE before including qemu-options.h */
-#include <sys/mman.h>
 #include <pwd.h>
 #include <grp.h>
 #include <libgen.h>
index b13ecbb025f418ad043a5014cf2a0424c4a695e3..c926e9a3790b12da5bad15841369b2b2379f70e1 100644 (file)
@@ -47,7 +47,6 @@
 #include <sys/times.h>
 #include <sys/wait.h>
 #include <termios.h>
-#include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
 #include <sys/socket.h>
index 37b73b543364ee9d0de37b9c7e264ef4522d3f82..4412a5590a9b70e07088ba07312337a081b288aa 100755 (executable)
@@ -105,6 +105,8 @@ for f in "$@"; do
     *include/qemu/osdep.h | \
     *include/qemu/compiler.h | \
     *include/glib-compat.h | \
+    *include/sysemu/os-posix.h | \
+    *include/sysemu/os-win32.h | \
     *include/standard-headers/ )
       # Removing include lines from osdep.h itself would be counterproductive.
       echo "SKIPPING $f (special case header)"
@@ -145,6 +147,7 @@ for f in "$@"; do
            <stdlib.h> <stdio.h> <string.h> <strings.h> <inttypes.h>
            <limits.h> <unistd.h> <time.h> <ctype.h> <errno.h> <fcntl.h>
            <sys/stat.h> <sys/time.h> <assert.h> <signal.h> <glib.h>
+           <sys/stat.h> <sys/time.h> <assert.h> <signal.h> <glib.h> <sys/mman.h>
            "sysemu/os-posix.h, sysemu/os-win32.h "glib-compat.h"
            "qemu/typedefs.h"
             ))' "$f"
index 83da447cb7754796bf626e072df803d37f32c367..5c2bd7a10b6e07dacc41de6c12aa11c3e67a43d1 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include <linux/kvm.h>
 
index c35c676e14001e4a98f6f1810af215b7f6bc5207..069da0c5fd101fedb912a60fd923c554a19c38bb 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include <linux/kvm.h>
 
index 2d6a310ebb1d9e24c701d6c50eb1e6de0a6133de..5faa76c57e069dfc136f2d03f0acd9ea0c589f65 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/ptrace.h>
 
 #include <linux/elf.h>
index abf50e66328bf5cad6d81bccc5f4b65855302e86..7b092ee3852a43c189d775df0ca7070094ee0709 100644 (file)
@@ -15,7 +15,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/utsname.h>
 
 #include <linux/kvm.h>
index a854e4de596dc44c02ab41538e37ceec4144b728..f3f832d4981812e3e94da38598aef563bd4aed7d 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include <linux/kvm.h>
 
index 6c153611c04b992de35a6005c040ce1c6801271c..16208649c5c29e00aa6a1ab7c6f8fafda5be7085 100644 (file)
@@ -17,7 +17,6 @@
 #include "qemu/osdep.h"
 #include <dirent.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/vfs.h>
 
 #include <linux/kvm.h>
index f108cd3875adf7de7d68a4e298d3247490819793..45e94ca48abd81e86a14bac522ec37e93ebe1e95 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 
 #include <linux/kvm.h>
 #include <asm/ptrace.h>
index bff999cf121fdb75a94e813d139ef00472da0e74..c1d9b3eb9e5f58b106a5e219c869abfa539326c3 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "libqtest.h"
 #include "libqos/pci.h"
index 010860a5b728858acef2f9a44c4aa621fe926704..0957ee75556cf4fe17faf4f8a90116d594b7144d 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include <glib/gstdio.h>
-#include <sys/mman.h>
 #include "contrib/ivshmem-server/ivshmem-server.h"
 #include "libqos/pci-pc.h"
 #include "libqtest.h"
index 9ff88eea0fe220c8ab755f30d90def5c393ccd31..a35efb3969e18da6c1d4e9f5a495934acf7e20ad 100644 (file)
@@ -26,7 +26,6 @@ const unsigned end_address = 100 * 1024 * 1024;
 bool got_stop;
 
 #if defined(__linux__)
-#include <sys/mman.h>
 #include <sys/syscall.h>
 #include <sys/vfs.h>
 #endif
index 0779ba260287091727f86c26c8fbbc4008fd8287..57c8f91c5e0ac4c698edf052fc92019d4b757285 100644 (file)
@@ -33,7 +33,6 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/unistd.h>
-#include <sys/mman.h>
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 #include <netdb.h>
index 2724fe975557d8a693daaea9cfc3750612b4a830..b2b1665ab84615fdabc37b14cd2a402f60bca0a4 100644 (file)
@@ -17,7 +17,6 @@
 #include "sysemu/sysemu.h"
 
 #include <linux/vhost.h>
-#include <sys/mman.h>
 #include <sys/vfs.h>
 #include <qemu/sockets.h>
 
index e8b88b448543734ac726e70611fa4328ea411883..3f402dfe04f5da25e1a3beb8a83917481ee95ff8 100644 (file)
@@ -18,8 +18,6 @@
  */
 #ifdef _WIN32
 #include <windows.h>
-#else
-#include <sys/mman.h>
 #endif
 #include "qemu/osdep.h"
 
index b374238a59c121d409b369a0c5930a1dccba0f7a..4571d1aba866a67de41721aa17e4f54e0df695ef 100644 (file)
@@ -29,8 +29,6 @@
 
 #include <glib/gprintf.h>
 
-#include <sys/mman.h>
-
 #include "qemu/memfd.h"
 
 #ifdef CONFIG_MEMFD
index 0b4cc7f7f1177f727c39b463782a71dc0b00d5ef..629d97a36244cacb12cc6ab890bb7f9c79a3454c 100644 (file)
@@ -11,7 +11,6 @@
  */
 #include "qemu/osdep.h"
 #include <qemu/mmap-alloc.h>
-#include <sys/mman.h>
 
 #define HUGETLBFS_MAGIC       0x958458f6
 
index 9a7a439e13663b797194b36b8b0b9d4d32dbeb6b..ff004e80743954935130a87a1ad3b8a49e9eeecc 100644 (file)
 
 /* Needed early for CONFIG_BSD etc. */
 
-#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE)
-#include <sys/mman.h>
-#endif
-
 #ifdef CONFIG_SOLARIS
 #include <sys/statvfs.h>
 /* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for
index 4adde93ac1aa12e5cded8167ff4d3cb2771285fd..e2e1d4d39f59f4a92e960524e43284ed5c21ae8a 100644 (file)
@@ -36,7 +36,6 @@
 #include "trace.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h"
-#include <sys/mman.h>
 #include <libgen.h>
 #include <sys/signal.h>
 #include "qemu/cutils.h"
index a0da8d7d917b2c31f5ae8203a601c10cebca6ff2..98ea44fdf34af0900e1f722870833d07e550a6e3 100644 (file)
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -9,7 +9,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <sys/mman.h>
 
 #include "cpu.h"
 #include "hw/pci/pci.h"
index 49f394a777d34cfabae642b0b60456282f9bc9e3..8f3a5920135264d0323ab598523b992e49ad743d 100644 (file)
@@ -17,7 +17,6 @@
 #include "qemu/bitmap.h"
 
 #include <xen/hvm/params.h>
-#include <sys/mman.h>
 
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"