@@ -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"
@@ -26,7 +26,6 @@
#include "qemu/osdep.h"
#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE)
-#include <sys/mman.h>
#endif
#include "block/block_int.h"
@@ -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"
@@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include <machine/trap.h>
-#include <sys/mman.h>
#include "qemu.h"
#include "qemu/path.h"
@@ -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"
@@ -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>
@@ -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"
@@ -21,7 +21,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <sys/uio.h>
#include "hw/hw.h"
@@ -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"
@@ -25,7 +25,6 @@
*/
#include "qemu/osdep.h"
-#include <sys/mman.h>
#include "hw/hw.h"
#include "ui/console.h"
@@ -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"
@@ -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
@@ -37,7 +37,6 @@
#include "qemu/osdep.h"
#if defined(CONFIG_POSIX)
-#include <sys/mman.h>
#endif
#include "hw/hw.h"
#include "hw/qdev.h"
@@ -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"
@@ -22,7 +22,6 @@
#include <libusb.h>
#include <stdio.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <sys/time.h>
#include "qemu/osdep.h"
@@ -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"
@@ -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"
@@ -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"
@@ -23,7 +23,6 @@
*/
#include "qemu/osdep.h"
-#include <sys/mman.h>
#include <sys/signal.h>
#include "hw/hw.h"
@@ -10,7 +10,6 @@
*/
#include "qemu/osdep.h"
-#include <sys/mman.h>
#include "hw/xen/xen_backend.h"
#include "xen_pt.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
@@ -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>
@@ -2,7 +2,6 @@
#include "qemu/osdep.h"
#include <sys/param.h>
-#include <sys/mman.h>
#include <sys/resource.h>
#include "qemu.h"
@@ -34,7 +34,6 @@
/****************************************************************************/
#include "qemu/osdep.h"
-#include <sys/mman.h>
#include "qemu.h"
#include "flat.h"
@@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu-version.h"
-#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/resource.h>
@@ -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>
@@ -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"
@@ -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>
@@ -52,7 +52,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 */
@@ -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>
@@ -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>
@@ -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>
@@ -104,6 +104,8 @@ for f in "$@"; do
;;
*include/qemu/osdep.h | \
*include/qemu/compiler.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)"
@@ -143,7 +145,7 @@ for f in "$@"; do
<setjmp.h> <stdarg.h> <stddef.h> <stdbool.h> <stdint.h> <sys/types.h>
<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>
+ <sys/stat.h> <sys/time.h> <assert.h> <signal.h> <sys/mman.h>
"sysemu/os-posix.h, sysemu/os-win32.h "glib-compat.h"
"qemu/typedefs.h"
))' "$f"
@@ -10,7 +10,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <linux/kvm.h>
@@ -10,7 +10,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <linux/kvm.h>
@@ -11,7 +11,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <sys/ptrace.h>
#include <linux/elf.h>
@@ -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>
@@ -11,7 +11,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <linux/kvm.h>
@@ -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>
@@ -23,7 +23,6 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
-#include <sys/mman.h>
#include <linux/kvm.h>
#include <asm/ptrace.h>
@@ -14,7 +14,6 @@
#include "qemu/osdep.h"
#include <glib.h>
-#include <sys/mman.h>
#include "libqtest.h"
#include "libqos/pci.h"
@@ -11,7 +11,6 @@
#include "qemu/osdep.h"
#include <glib.h>
#include <glib/gstdio.h>
-#include <sys/mman.h>
#include "contrib/ivshmem-server/ivshmem-server.h"
#include "libqos/pci-pc.h"
#include "libqtest.h"
@@ -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>
@@ -18,7 +18,6 @@
#include "sysemu/sysemu.h"
#include <linux/vhost.h>
-#include <sys/mman.h>
#include <sys/vfs.h>
#include <qemu/sockets.h>
@@ -18,8 +18,6 @@
*/
#ifdef _WIN32
#include <windows.h>
-#else
-#include <sys/mman.h>
#endif
#include "qemu/osdep.h"
@@ -30,8 +30,6 @@
#include <glib.h>
#include <glib/gprintf.h>
-#include <sys/mman.h>
-
#include "qemu/memfd.h"
#ifdef CONFIG_MEMFD
@@ -11,7 +11,6 @@
*/
#include "qemu/osdep.h"
#include <qemu/mmap-alloc.h>
-#include <sys/mman.h>
#define HUGETLBFS_MAGIC 0x958458f6
@@ -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
@@ -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"
@@ -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"
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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- audio/ossaudio.c | 1 - block/qcow2-cache.c | 1 - bsd-user/elfload.c | 1 - bsd-user/main.c | 1 - bsd-user/mmap.c | 1 - bsd-user/syscall.c | 1 - contrib/ivshmem-server/ivshmem-server.c | 1 - exec.c | 1 - hw/block/xen_disk.c | 1 - hw/char/xen_console.c | 1 - hw/display/xenfb.c | 1 - hw/i386/kvm/pci-assign.c | 1 - hw/misc/ivshmem.c | 2 -- hw/misc/pc-testdev.c | 1 - hw/net/xen_nic.c | 1 - hw/usb/xen-usb.c | 1 - hw/vfio/common.c | 1 - hw/vfio/pci.c | 1 - hw/virtio/virtio-balloon.c | 4 ---- hw/xen/xen_backend.c | 1 - hw/xen/xen_pt_msi.c | 1 - include/qemu/osdep.h | 2 -- include/sysemu/os-posix.h | 1 + kvm-all.c | 1 - linux-user/elfload.c | 1 - linux-user/flatload.c | 1 - linux-user/main.c | 1 - linux-user/mmap.c | 1 - linux-user/strace.c | 1 - linux-user/syscall.c | 1 - migration/postcopy-ram.c | 1 - net/netmap.c | 1 - os-posix.c | 1 - qemu-char.c | 1 - scripts/clean-includes | 4 +++- target-arm/kvm.c | 1 - target-arm/kvm32.c | 1 - target-arm/kvm64.c | 1 - target-i386/kvm.c | 1 - target-mips/kvm.c | 1 - target-ppc/kvm.c | 1 - target-s390x/kvm.c | 1 - tests/i440fx-test.c | 1 - tests/ivshmem-test.c | 1 - tests/vhost-user-bridge.c | 1 - tests/vhost-user-test.c | 1 - translate-all.c | 2 -- util/memfd.c | 2 -- util/mmap-alloc.c | 1 - util/osdep.c | 4 ---- util/oslib-posix.c | 1 - xen-hvm.c | 1 - xen-mapcache.c | 1 - 53 files changed, 4 insertions(+), 62 deletions(-)