Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
os-posix: include sys/mman.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini committed Jun 16, 2016
1 parent 8926692 commit 02d0e09
Show file tree
Hide file tree
Showing 54 changed files with 4 additions and 68 deletions.
1 change: 0 additions & 1 deletion audio/ossaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions block/qcow2-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion bsd-user/elfload.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 0 additions & 1 deletion bsd-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include <machine/trap.h>
#include <sys/mman.h>

#include "qemu.h"
#include "qemu/path.h"
Expand Down
1 change: 0 additions & 1 deletion bsd-user/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion bsd-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion contrib/ivshmem-server/ivshmem-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#ifndef _WIN32
#include <sys/mman.h>
#endif

#include "qemu/cutils.h"
Expand Down
1 change: 0 additions & 1 deletion hw/block/xen_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/uio.h>

#include "hw/hw.h"
Expand Down
1 change: 0 additions & 1 deletion hw/char/xen_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion hw/display/xenfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/

#include "qemu/osdep.h"
#include <sys/mman.h>

#include "hw/hw.h"
#include "ui/console.h"
Expand Down
1 change: 0 additions & 1 deletion hw/i386/kvm/pci-assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions hw/misc/ivshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions hw/misc/pc-testdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion hw/net/xen_nic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion hw/usb/xen-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "qemu/osdep.h"
#include <libusb.h>
#include <sys/mman.h>

#include "qemu-common.h"
#include "qemu/config-file.h"
Expand Down
1 change: 0 additions & 1 deletion hw/vfio/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion hw/vfio/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions hw/virtio/virtio-balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion hw/xen/xen_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

#include "qemu/osdep.h"
#include <sys/mman.h>
#include <sys/signal.h>

#include "hw/hw.h"
Expand Down
1 change: 0 additions & 1 deletion hw/xen/xen_pt_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

#include "qemu/osdep.h"
#include <sys/mman.h>

#include "hw/xen/xen_backend.h"
#include "xen_pt.h"
Expand Down
2 changes: 0 additions & 2 deletions include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/sysemu/os-posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <linux/kvm.h>

Expand Down
1 change: 0 additions & 1 deletion linux-user/elfload.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "qemu/osdep.h"
#include <sys/param.h>

#include <sys/mman.h>
#include <sys/resource.h>

#include "qemu.h"
Expand Down
1 change: 0 additions & 1 deletion linux-user/flatload.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
/****************************************************************************/

#include "qemu/osdep.h"
#include <sys/mman.h>

#include "qemu.h"
#include "flat.h"
Expand Down
1 change: 0 additions & 1 deletion linux-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu-version.h"
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/resource.h>

Expand Down
1 change: 0 additions & 1 deletion linux-user/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion linux-user/strace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion migration/postcopy-ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion net/netmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion os-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion qemu-char.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions scripts/clean-includes
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion target-arm/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <linux/kvm.h>

Expand Down
1 change: 0 additions & 1 deletion target-arm/kvm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <linux/kvm.h>

Expand Down
1 change: 0 additions & 1 deletion target-arm/kvm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/ptrace.h>

#include <linux/elf.h>
Expand Down
1 change: 0 additions & 1 deletion target-i386/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion target-mips/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <linux/kvm.h>

Expand Down
1 change: 0 additions & 1 deletion target-ppc/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion target-s390x/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <linux/kvm.h>
#include <asm/ptrace.h>
Expand Down
1 change: 0 additions & 1 deletion tests/i440fx-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/

#include "qemu/osdep.h"
#include <sys/mman.h>

#include "libqtest.h"
#include "libqos/pci.h"
Expand Down
1 change: 0 additions & 1 deletion tests/ivshmem-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion tests/postcopy-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/vhost-user-bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion tests/vhost-user-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "sysemu/sysemu.h"

#include <linux/vhost.h>
#include <sys/mman.h>
#include <sys/vfs.h>
#include <qemu/sockets.h>

Expand Down
Loading

0 comments on commit 02d0e09

Please sign in to comment.