diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-06-06 13:57:39 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-06-16 18:39:03 +0200 |
commit | 02d0e095031b7fda77de8b558465a57659ea79cb (patch) | |
tree | 78ce56328efb58eec9c99584b71229bae47d3030 | |
parent | 89266923df71e51f406184d3e8b55d2a3aaa4c4d (diff) | |
download | qemu-02d0e095031b7fda77de8b558465a57659ea79cb.tar.gz qemu-02d0e095031b7fda77de8b558465a57659ea79cb.tar.bz2 qemu-02d0e095031b7fda77de8b558465a57659ea79cb.zip |
os-posix: include sys/mman.h
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, 4 insertions, 68 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c index a0d9cda1ec..0edd7ea5fe 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -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" diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 208a060421..580631c3d8 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -24,11 +24,6 @@ /* 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" diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 898ee05472..41a1309296 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -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" diff --git a/bsd-user/main.c b/bsd-user/main.c index 9f592be96f..abe9a26f9b 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" #include <machine/trap.h> -#include <sys/mman.h> #include "qemu.h" #include "qemu/path.h" diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 6ab5334702..610f91b285 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -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" diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 47cf865a32..a9fe8693c1 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -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> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index bf4ee0b2e2..e2f295bd43 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -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> @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #ifndef _WIN32 -#include <sys/mman.h> #endif #include "qemu/cutils.h" diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index cf57814fb6..90aca73121 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/uio.h> #include "hw/hw.h" diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index cbf1dccbb1..83108b0bdb 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -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" diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 570b0977c3..46b7d5eded 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -25,7 +25,6 @@ */ #include "qemu/osdep.h" -#include <sys/mman.h> #include "hw/hw.h" #include "ui/console.h" diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index db2cbd2002..dd9e73b6f5 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -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" diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 90be9f7617..c4dde3a52e 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -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 diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c index 086893dcca..b81d820084 100644 --- a/hw/misc/pc-testdev.c +++ b/hw/misc/pc-testdev.c @@ -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" diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index 7281730d94..0b4ddae48c 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -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" diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 8fa47edd9a..0fd34c62c4 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include <libusb.h> -#include <sys/mman.h> #include "qemu-common.h" #include "qemu/config-file.h" diff --git a/hw/vfio/common.c b/hw/vfio/common.c index e51ed3a348..5ff5e9220a 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -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" diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index deab0c601a..53b87b76ea 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -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" diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 8c15e09470..557d3f9e0c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -27,10 +27,6 @@ #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" diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index c63f9df38b..e7ce724567 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <sys/mman.h> #include <sys/signal.h> #include "hw/hw.h" diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c index 9a16f2bff1..62add0639f 100644 --- a/hw/xen/xen_pt_msi.c +++ b/hw/xen/xen_pt_msi.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" -#include <sys/mman.h> #include "hw/xen/xen_backend.h" #include "xen_pt.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 693769403f..e63da2831a 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -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 diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 07e3e5ae9b..9c7dfdfbec 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -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> @@ -15,7 +15,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <linux/kvm.h> diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bb2558f284..f807baf389 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2,7 +2,6 @@ #include "qemu/osdep.h" #include <sys/param.h> -#include <sys/mman.h> #include <sys/resource.h> #include "qemu.h" diff --git a/linux-user/flatload.c b/linux-user/flatload.c index f9139c399a..48ad1c5e9e 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -34,7 +34,6 @@ /****************************************************************************/ #include "qemu/osdep.h" -#include <sys/mman.h> #include "qemu.h" #include "flat.h" diff --git a/linux-user/main.c b/linux-user/main.c index f8a8764ae9..b9a4e0ea45 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" #include "qemu-version.h" -#include <sys/mman.h> #include <sys/syscall.h> #include <sys/resource.h> diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 3519147bce..c4371d943a 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -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> diff --git a/linux-user/strace.c b/linux-user/strace.c index c5980a128c..4046b81705 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -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" diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 71ccbd9c5e..1c17b741c2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -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> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 47250b675d..abe8c60a90 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -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 */ diff --git a/net/netmap.c b/net/netmap.c index 6cc0db5ee1..64967b947e 100644 --- a/net/netmap.c +++ b/net/netmap.c @@ -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> diff --git a/os-posix.c b/os-posix.c index 107fde38bf..3755265582 100644 --- a/os-posix.c +++ b/os-posix.c @@ -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> diff --git a/qemu-char.c b/qemu-char.c index b13ecbb025..c926e9a379 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -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> diff --git a/scripts/clean-includes b/scripts/clean-includes index 37b73b5433..4412a5590a 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -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" diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 83da447cb7..5c2bd7a10b 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -10,7 +10,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <linux/kvm.h> diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c index c35c676e14..069da0c5fd 100644 --- a/target-arm/kvm32.c +++ b/target-arm/kvm32.c @@ -10,7 +10,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <linux/kvm.h> diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c index 2d6a310ebb..5faa76c57e 100644 --- a/target-arm/kvm64.c +++ b/target-arm/kvm64.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/ptrace.h> #include <linux/elf.h> diff --git a/target-i386/kvm.c b/target-i386/kvm.c index abf50e6632..7b092ee385 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -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> diff --git a/target-mips/kvm.c b/target-mips/kvm.c index a854e4de59..f3f832d498 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <linux/kvm.h> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 6c153611c0..16208649c5 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -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> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index f108cd3875..45e94ca48a 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -23,7 +23,6 @@ #include "qemu/osdep.h" #include <sys/ioctl.h> -#include <sys/mman.h> #include <linux/kvm.h> #include <asm/ptrace.h> diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index bff999cf12..c1d9b3eb9e 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <sys/mman.h> #include "libqtest.h" #include "libqos/pci.h" diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 010860a5b7..0957ee7555 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -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" diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index 9ff88eea0f..a35efb3969 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -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 diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 0779ba2602..57c8f91c5e 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -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> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2724fe9755..b2b1665ab8 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -17,7 +17,6 @@ #include "sysemu/sysemu.h" #include <linux/vhost.h> -#include <sys/mman.h> #include <sys/vfs.h> #include <qemu/sockets.h> diff --git a/translate-all.c b/translate-all.c index e8b88b4485..3f402dfe04 100644 --- a/translate-all.c +++ b/translate-all.c @@ -18,8 +18,6 @@ */ #ifdef _WIN32 #include <windows.h> -#else -#include <sys/mman.h> #endif #include "qemu/osdep.h" diff --git a/util/memfd.c b/util/memfd.c index b374238a59..4571d1aba8 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -29,8 +29,6 @@ #include <glib/gprintf.h> -#include <sys/mman.h> - #include "qemu/memfd.h" #ifdef CONFIG_MEMFD diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 0b4cc7f7f1..629d97a362 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" #include <qemu/mmap-alloc.h> -#include <sys/mman.h> #define HUGETLBFS_MAGIC 0x958458f6 diff --git a/util/osdep.c b/util/osdep.c index 9a7a439e13..ff004e8074 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -25,10 +25,6 @@ /* 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 diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 4adde93ac1..e2e1d4d39f 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -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" @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <sys/mman.h> #include "cpu.h" #include "hw/pci/pci.h" diff --git a/xen-mapcache.c b/xen-mapcache.c index 49f394a777..8f3a592013 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -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" |