diff options
151 files changed, 316 insertions, 239 deletions
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index e4fb48b803..72467fd907 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -8,6 +8,7 @@ * This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2835_peripherals.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "hw/arm/raspi_platform.h" diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 8a4d13c7d9..15c7622ad1 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -8,6 +8,7 @@ * This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 7d3d21ab32..48d014c8d3 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -8,6 +8,7 @@ * This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2836.h" #include "qemu/error-report.h" #include "hw/boards.h" diff --git a/hw/block/nand.c b/hw/block/nand.c index 478e1a6b3f..f51e13fcac 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -18,8 +18,9 @@ #ifndef NAND_IO -# include "hw/hw.h" -# include "hw/block/flash.h" +#include "qemu/osdep.h" +#include "hw/hw.h" +#include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "hw/qdev.h" #include "qemu/error-report.h" diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c index 005a72b1e2..80513b28fd 100644 --- a/hw/intc/bcm2835_ic.c +++ b/hw/intc/bcm2835_ic.c @@ -12,6 +12,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/intc/bcm2835_ic.h" #define GPU_IRQS 64 diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c index ad622aa99f..d0271810cc 100644 --- a/hw/intc/bcm2836_control.c +++ b/hw/intc/bcm2836_control.c @@ -13,6 +13,7 @@ * https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf */ +#include "qemu/osdep.h" #include "hw/intc/bcm2836_control.h" #define REG_GPU_ROUTE 0x0c diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index df1d6e6ad6..500baba7c0 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -8,6 +8,7 @@ * https://github.com/raspberrypi/firmware/wiki/Accessing-mailboxes */ +#include "qemu/osdep.h" #include "hw/misc/bcm2835_mbox.h" #define MAIL0_PEEK 0x90 diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 45bd6c18ce..581922abd7 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -3,6 +3,7 @@ * This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/misc/bcm2835_property.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "sysemu/dma.h" diff --git a/include/io/channel-buffer.h b/include/io/channel-buffer.h index 91a52b3373..65c498b2c2 100644 --- a/include/io/channel-buffer.h +++ b/include/io/channel-buffer.h @@ -42,7 +42,7 @@ struct QIOChannelBuffer { size_t capacity; /* Total allocated memory */ size_t usage; /* Current size of data */ size_t offset; /* Offset for future I/O ops */ - char *data; + uint8_t *data; }; diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h index 810537ef6f..70d06b40d9 100644 --- a/include/io/channel-socket.h +++ b/include/io/channel-socket.h @@ -105,7 +105,9 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc, * Attempt to connect to the address @addr. This method * will run in the background so the caller will regain * execution control immediately. The function @callback - * will be invoked on completion or failure. + * will be invoked on completion or failure. The @addr + * parameter will be copied, so may be freed as soon + * as this function returns without waiting for completion. */ void qio_channel_socket_connect_async(QIOChannelSocket *ioc, SocketAddress *addr, @@ -140,7 +142,9 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, * Attempt to listen to the address @addr. This method * will run in the background so the caller will regain * execution control immediately. The function @callback - * will be invoked on completion or failure. + * will be invoked on completion or failure. The @addr + * parameter will be copied, so may be freed as soon + * as this function returns without waiting for completion. */ void qio_channel_socket_listen_async(QIOChannelSocket *ioc, SocketAddress *addr, @@ -181,6 +185,9 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc, * This method will run in the background so the caller * will regain execution control immediately. The function * @callback will be invoked on completion or failure. + * The @localAddr and @remoteAddr parameters will be copied, + * so may be freed as soon as this function returns without + * waiting for completion. */ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc, SocketAddress *localAddr, diff --git a/include/io/channel-util.h b/include/io/channel-util.h new file mode 100644 index 0000000000..c93af82884 --- /dev/null +++ b/include/io/channel-util.h @@ -0,0 +1,52 @@ +/* + * QEMU I/O channels utility APIs + * + * Copyright (c) 2016 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef QIO_CHANNEL_UTIL_H__ +#define QIO_CHANNEL_UTIL_H__ + +#include "io/channel.h" + +/* + * This module provides helper functions that are useful when dealing + * with QIOChannel objects + */ + + +/** + * qio_channel_new_fd: + * @fd: the file descriptor + * @errp: pointer to a NULL-initialized error object + * + * Create a channel for performing I/O on the file + * descriptor @fd. The particular subclass of QIOChannel + * that is returned will depend on what underlying object + * the file descriptor is associated with. It may be either + * a QIOChannelSocket or a QIOChannelFile instance. Upon + * success, the returned QIOChannel instance will own + * the @fd file descriptor, and take responsibility for + * closing it when no longer required. On failure, the + * caller is responsible for closing @fd. + * + * Returns: the channel object, or NULL on error + */ +QIOChannel *qio_channel_new_fd(int fd, + Error **errp); + +#endif /* QIO_CHANNEL_UTIL_H__ */ diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 59a7f8deca..cc055c909e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -27,6 +27,17 @@ #include "config-host.h" #include "qemu/compiler.h" + +/* The following block of code temporarily renames the daemon() function so the + * compiler does not see the warning associated with it in stdlib.h on OSX + */ +#ifdef __APPLE__ +#define daemon qemu_fake_daemon_function +#include <stdlib.h> +#undef daemon +extern int daemon(int, int); +#endif + #include <stdarg.h> #include <stddef.h> #include <stdbool.h> diff --git a/io/Makefile.objs b/io/Makefile.objs index 0e3de31a5a..9d8337d89a 100644 --- a/io/Makefile.objs +++ b/io/Makefile.objs @@ -6,4 +6,5 @@ io-obj-y += channel-socket.o io-obj-y += channel-tls.o io-obj-y += channel-watch.o io-obj-y += channel-websock.o +io-obj-y += channel-util.o io-obj-y += task.o diff --git a/io/channel-buffer.c b/io/channel-buffer.c index 0f7c5671fe..3e5117bf28 100644 --- a/io/channel-buffer.c +++ b/io/channel-buffer.c @@ -32,7 +32,7 @@ qio_channel_buffer_new(size_t capacity) ioc = QIO_CHANNEL_BUFFER(object_new(TYPE_QIO_CHANNEL_BUFFER)); if (capacity) { - ioc->data = g_new0(char, capacity); + ioc->data = g_new0(uint8_t, capacity); ioc->capacity = capacity; } diff --git a/io/channel-util.c b/io/channel-util.c new file mode 100644 index 0000000000..f96907cb5c --- /dev/null +++ b/io/channel-util.c @@ -0,0 +1,50 @@ +/* + * QEMU I/O channels utility APIs + * + * Copyright (c) 2016 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "io/channel-util.h" +#include "io/channel-file.h" +#include "io/channel-socket.h" + + +static bool fd_is_socket(int fd) +{ + int optval; + socklen_t optlen; + optlen = sizeof(optval); + return qemu_getsockopt(fd, + SOL_SOCKET, + SO_TYPE, + (char *)&optval, + &optlen) == 0; +} + + +QIOChannel *qio_channel_new_fd(int fd, + Error **errp) +{ + QIOChannel *ioc; + + if (fd_is_socket(fd)) { + ioc = QIO_CHANNEL(qio_channel_socket_new_fd(fd, errp)); + } else { + ioc = QIO_CHANNEL(qio_channel_file_new_fd(fd)); + } + return ioc; +} diff --git a/libdecnumber/decContext.c b/libdecnumber/decContext.c index 68e6f60e96..7d97a65ac5 100644 --- a/libdecnumber/decContext.c +++ b/libdecnumber/decContext.c @@ -35,8 +35,7 @@ /* context structures. */ /* ------------------------------------------------------------------ */ -#include <string.h> /* for strcmp */ -#include <stdio.h> /* for printf if DECCHECK */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #include "libdecnumber/decContext.h" #include "libdecnumber/decNumberLocal.h" diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c index ca1412f30b..c9e7807f87 100644 --- a/libdecnumber/decNumber.c +++ b/libdecnumber/decNumber.c @@ -166,10 +166,7 @@ /* ** -- raise to the power */ /* ------------------------------------------------------------------ */ -#include <stdlib.h> /* for malloc, free, etc. */ -#include <stdio.h> /* for printf [if needed] */ -#include <string.h> /* for strcpy */ -#include <ctype.h> /* for lower */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #include "libdecnumber/decNumber.h" #include "libdecnumber/decNumberLocal.h" diff --git a/libdecnumber/dpd/decimal128.c b/libdecnumber/dpd/decimal128.c index 7551b7caaf..ca4764e547 100644 --- a/libdecnumber/dpd/decimal128.c +++ b/libdecnumber/dpd/decimal128.c @@ -39,8 +39,7 @@ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 34 /* make decNumbers with space for 34 */ diff --git a/libdecnumber/dpd/decimal32.c b/libdecnumber/dpd/decimal32.c index 095ab75654..53f29789d7 100644 --- a/libdecnumber/dpd/decimal32.c +++ b/libdecnumber/dpd/decimal32.c @@ -39,8 +39,7 @@ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 7 /* make decNumbers with space for 7 */ diff --git a/libdecnumber/dpd/decimal64.c b/libdecnumber/dpd/decimal64.c index 8256084e90..4816176410 100644 --- a/libdecnumber/dpd/decimal64.c +++ b/libdecnumber/dpd/decimal64.c @@ -39,8 +39,7 @@ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 16 /* make decNumbers with space for 16 */ diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh index 888548e58b..fb1f3363f7 100644 --- a/scripts/feature_to_c.sh +++ b/scripts/feature_to_c.sh @@ -36,7 +36,7 @@ for input; do arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'` ${AWK:-awk} 'BEGIN { n = 0 - printf "#include \"config.h\"\n" + printf "#include \"qemu/osdep.h\"\n" printf "#include \"qemu-common.h\"\n" printf "#include \"exec/gdbstub.h\"\n" print "static const char '$arrayname'[] = {" diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 91c5a4e8cd..f831621843 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -297,6 +297,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/module.h" #include "qapi/qmp/types.h" diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index 07bcb73d3d..544ae1218d 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -159,6 +159,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "%(prefix)sqapi-event.h" #include "%(prefix)sqapi-visit.h" diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py index 64f2cd0631..e0f926be04 100644 --- a/scripts/qapi-introspect.py +++ b/scripts/qapi-introspect.py @@ -1,7 +1,7 @@ # # QAPI introspection generator # -# Copyright (C) 2015 Red Hat, Inc. +# Copyright (C) 2015-2016 Red Hat, Inc. # # Authors: # Markus Armbruster <armbru@redhat.com> @@ -204,6 +204,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "%(prefix)sqmp-introspect.h" ''', diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index d3f631a2f4..7b0dca8c72 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -279,6 +279,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h" @@ -287,8 +288,6 @@ fdef.write(mcgen(''' # To avoid circular headers, use only typedefs.h here, not qobject.h fdecl.write(mcgen(''' -#include <stdbool.h> -#include <stdint.h> #include "qemu/typedefs.h" ''')) diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 0fdcebcca8..0cc9b08b14 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -435,6 +435,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "%(prefix)sqapi-visit.h" ''', diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py index e8c2cd57e9..3246c20015 100644 --- a/scripts/tracetool/backend/simple.py +++ b/scripts/tracetool/backend/simple.py @@ -42,7 +42,8 @@ def generate_h(event): def generate_c_begin(events): - out('#include "trace.h"', + out('#include "qemu/osdep.h"', + '#include "trace.h"', '#include "trace/control.h"', '#include "trace/simple.h"', '') diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py index 2717ea3a0b..1cc6a49a71 100644 --- a/scripts/tracetool/format/events_c.py +++ b/scripts/tracetool/format/events_c.py @@ -19,6 +19,7 @@ from tracetool import out def generate(events, backend): out('/* This file is autogenerated by tracetool, do not edit. */', '', + '#include "qemu/osdep.h"', '#include "trace.h"', '#include "trace/generated-events.h"', '#include "trace/control.h"', diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py index 96655a0590..afd6e98537 100644 --- a/scripts/tracetool/format/tcg_helper_c.py +++ b/scripts/tracetool/format/tcg_helper_c.py @@ -23,6 +23,7 @@ def generate(events, backend): out('/* This file is autogenerated by tracetool, do not edit. */', '', + '#include "qemu/osdep.h"', '#include "qemu-common.h"', '#include "trace.h"', '#include "exec/helper-proto.h"', diff --git a/stubs/blockdev-close-all-bdrv-states.c b/stubs/blockdev-close-all-bdrv-states.c index 12d2442362..f1f1d9cdca 100644 --- a/stubs/blockdev-close-all-bdrv-states.c +++ b/stubs/blockdev-close-all-bdrv-states.c @@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "block/block_int.h" void blockdev_close_all_bdrv_states(void) diff --git a/target-cris/mmu.c b/target-cris/mmu.c index 1c95a415f2..4278d2dce4 100644 --- a/target-cris/mmu.c +++ b/target-cris/mmu.c @@ -18,8 +18,7 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_USER_ONLY - +#include "qemu/osdep.h" #include "cpu.h" #include "mmu.h" @@ -360,4 +359,3 @@ int cris_mmu_translate(struct cris_mmu_result *res, env->pregs[PR_SRS] = old_srs; return miss; } -#endif diff --git a/tests/ac97-test.c b/tests/ac97-test.c index af30ea1dd6..75cab8f98f 100644 --- a/tests/ac97-test.c +++ b/tests/ac97-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 75ec330ceb..7155fecdbf 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -10,13 +10,11 @@ * See the COPYING file in the top-level directory. */ -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h> #include <glib/gstdio.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/compiler.h" #include "hw/acpi/acpi-defs.h" #include "hw/smbios/smbios.h" #include "qemu/bitmap.h" diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c index 360a6911eb..210964a00c 100644 --- a/tests/boot-order-test.c +++ b/tests/boot-order-test.c @@ -10,7 +10,7 @@ * See the COPYING file in the top-level directory. */ -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h" diff --git a/tests/check-qdict.c b/tests/check-qdict.c index a136f2addf..a43056c5de 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -9,6 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h" diff --git a/tests/check-qfloat.c b/tests/check-qfloat.c index 6404ac8df6..3102608f55 100644 --- a/tests/check-qfloat.c +++ b/tests/check-qfloat.c @@ -10,6 +10,7 @@ * See the COPYING.LIB file in the top-level directory. * */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qfloat.h" diff --git a/tests/check-qint.c b/tests/check-qint.c index 86868844ab..c86f7dfa38 100644 --- a/tests/check-qint.c +++ b/tests/check-qint.c @@ -9,6 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h" diff --git a/tests/check-qjson.c b/tests/check-qjson.c index 61e9bfbabf..99de6f5252 100644 --- a/tests/check-qjson.c +++ b/tests/check-qjson.c @@ -10,6 +10,7 @@ * See the COPYING.LIB file in the top-level directory. * */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qstring.h" diff --git a/tests/check-qlist.c b/tests/check-qlist.c index b9c05d43fd..f231d5fa97 100644 --- a/tests/check-qlist.c +++ b/tests/check-qlist.c @@ -9,6 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h" diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index f06380ef14..09354deb70 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -9,6 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qom/object.h" diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index 448d270b68..a2bb556906 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -18,6 +18,7 @@ * Author: Daniel P. Berrange <berrange@redhat.com> */ +#include "qemu/osdep.h" #include <glib.h> #include "qom/object.h" diff --git a/tests/check-qstring.c b/tests/check-qstring.c index 95dc9e3e7b..9877b42c89 100644 --- a/tests/check-qstring.c +++ b/tests/check-qstring.c @@ -9,6 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qstring.h" diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c index 47b4c7ba53..64073d3bd3 100644 --- a/tests/crypto-tls-x509-helpers.c +++ b/tests/crypto-tls-x509-helpers.c @@ -18,10 +18,8 @@ * Author: Daniel P. Berrange <berrange@redhat.com> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "qemu/sockets.h" diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index 11d5fea3e2..4477926014 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -17,8 +17,8 @@ * bugs around here. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "libqtest.h" diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c index 7694344eaf..5706d338a1 100644 --- a/tests/display-vga-test.c +++ b/tests/display-vga-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void pci_cirrus(void) { diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index 33909469f1..fe03236f3a 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" static void drive_add(void) diff --git a/tests/ds1338-test.c b/tests/ds1338-test.c index 7d513d8972..2792415841 100644 --- a/tests/ds1338-test.c +++ b/tests/ds1338-test.c @@ -17,6 +17,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/i2c.h" diff --git a/tests/e1000-test.c b/tests/e1000-test.c index 7ca6d7e72e..a42b3810c1 100644 --- a/tests/e1000-test.c +++ b/tests/e1000-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void test_device(gconstpointer data) diff --git a/tests/eepro100-test.c b/tests/eepro100-test.c index 8bfaccdcbb..e17eed0b7a 100644 --- a/tests/eepro100-test.c +++ b/tests/eepro100-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void test_device(gconstpointer data) { diff --git a/tests/endianness-test.c b/tests/endianness-test.c index 2054338e18..cc5bccd88e 100644 --- a/tests/endianness-test.c +++ b/tests/endianness-test.c @@ -11,11 +11,8 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h" #include "qemu/bswap.h" diff --git a/tests/es1370-test.c b/tests/es1370-test.c index cc23fb5c67..824dc31c64 100644 --- a/tests/es1370-test.c +++ b/tests/es1370-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/fdc-test.c b/tests/fdc-test.c index dbabf50a9a..53df1d0d88 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -22,9 +22,7 @@ * THE SOFTWARE. */ -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h> diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index b7d4007e32..398643aada 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -10,7 +10,7 @@ * See the COPYING file in the top-level directory. */ -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index 13b763d6a7..c8e669ac26 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -15,10 +15,8 @@ * Improvements welcome. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index 7fa170990f..05029e90b2 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -12,13 +12,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdio.h> -#include <unistd.h> -#include <errno.h> #include <sys/mman.h> -#include <stdlib.h> #include "libqtest.h" #include "libqos/pci.h" @@ -27,8 +23,6 @@ #define BROKEN 1 -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - typedef struct TestData { int num_cpus; diff --git a/tests/i82801b11-test.c b/tests/i82801b11-test.c index 78d9ce0e6b..c3b5ebbca1 100644 --- a/tests/i82801b11-test.c +++ b/tests/i82801b11-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/intel-hda-test.c b/tests/intel-hda-test.c index d89b407dcc..1be6add9b5 100644 --- a/tests/intel-hda-test.c +++ b/tests/intel-hda-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #define HDA_ID "hda0" #define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \ diff --git a/tests/io-channel-helpers.c b/tests/io-channel-helpers.c index 78d36dd703..844066904b 100644 --- a/tests/io-channel-helpers.c +++ b/tests/io-channel-helpers.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include "io-channel-helpers.h" struct QIOChannelTest { diff --git a/tests/ioh3420-test.c b/tests/ioh3420-test.c index c991a5f873..93eb2f7506 100644 --- a/tests/ioh3420-test.c +++ b/tests/ioh3420-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/ipmi-bt-test.c b/tests/ipmi-bt-test.c index 5b7eb73949..812907fb7b 100644 --- a/tests/ipmi-bt-test.c +++ b/tests/ipmi-bt-test.c @@ -22,10 +22,7 @@ * THE SOFTWARE. */ -#include <sys/types.h> -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <sys/socket.h> #include <netinet/in.h> diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c index 564c470f55..42c4b974c5 100644 --- a/tests/ipmi-kcs-test.c +++ b/tests/ipmi-kcs-test.c @@ -22,9 +22,7 @@ * THE SOFTWARE. */ -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h> diff --git a/tests/ipoctal232-test.c b/tests/ipoctal232-test.c index 3ac1714b48..846aaf5711 100644 --- a/tests/ipoctal232-test.c +++ b/tests/ipoctal232-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 705fece717..e184c67a1d 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -8,17 +8,13 @@ * See the COPYING file in the top-level directory. */ -#include <errno.h> -#include <fcntl.h> +#include "qemu/osdep.h" #include <glib.h> #include <glib/gstdio.h> -#include <string.h> #include <sys/mman.h> -#include <unistd.h> #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/pci-pc.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qemu-common.h" #define TMPSHMSIZE (1 << 20) diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c index ef00fedf1a..76894d5759 100644 --- a/tests/libqos/fw_cfg.c +++ b/tests/libqos/fw_cfg.c @@ -12,6 +12,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h" diff --git a/tests/libqos/i2c-imx.c b/tests/libqos/i2c-imx.c index b5cef66b94..51c3468f97 100644 --- a/tests/libqos/i2c-imx.c +++ b/tests/libqos/i2c-imx.c @@ -17,12 +17,11 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include <glib.h> -#include <string.h> -#include "qemu/osdep.h" #include "libqtest.h" #include "hw/i2c/imx_i2c.h" diff --git a/tests/libqos/i2c-omap.c b/tests/libqos/i2c-omap.c index 3d4d45d848..2028f2f146 100644 --- a/tests/libqos/i2c-omap.c +++ b/tests/libqos/i2c-omap.c @@ -6,12 +6,11 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include <glib.h> -#include <string.h> -#include "qemu/osdep.h" #include "qemu/bswap.h" #include "libqtest.h" diff --git a/tests/libqos/i2c.c b/tests/libqos/i2c.c index da7592f713..23bc2a3eb2 100644 --- a/tests/libqos/i2c.c +++ b/tests/libqos/i2c.c @@ -6,6 +6,7 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include "libqtest.h" diff --git a/tests/libqos/libqos-pc.c b/tests/libqos/libqos-pc.c index 1403699377..72b5e3ba09 100644 --- a/tests/libqos/libqos-pc.c +++ b/tests/libqos/libqos-pc.c @@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "libqos/libqos-pc.h" #include "libqos/malloc-pc.h" diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c index 2d1a802dbe..79b0b29b4d 100644 --- a/tests/libqos/libqos.c +++ b/tests/libqos/libqos.c @@ -1,9 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> -#include <unistd.h> -#include <fcntl.h> #include <sys/wait.h> #include "libqtest.h" diff --git a/tests/libqos/malloc-generic.c b/tests/libqos/malloc-generic.c index d30a2f4240..6000df2b82 100644 --- a/tests/libqos/malloc-generic.c +++ b/tests/libqos/malloc-generic.c @@ -7,6 +7,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqos/malloc-generic.h" #include "libqos/malloc.h" diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c index 6e253b6877..74f76c59db 100644 --- a/tests/libqos/malloc-pc.c +++ b/tests/libqos/malloc-pc.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/malloc-pc.h" #include "libqos/fw_cfg.h" diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index 19d05cafa6..c0df52f338 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -10,10 +10,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/malloc.h" #include "qemu-common.h" -#include <stdio.h> -#include <inttypes.h> #include <glib.h> typedef QTAILQ_HEAD(MemList, MemBlock) MemList; diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c index 6dba0db00a..08167c09fe 100644 --- a/tests/libqos/pci-pc.c +++ b/tests/libqos/pci-pc.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/pci-pc.h" diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c index 80b1a2117d..0e104e14ed 100644 --- a/tests/libqos/pci.c +++ b/tests/libqos/pci.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/pci.h" #include "hw/pci/pci_regs.h" diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c index 41d89b8487..87efb90782 100644 --- a/tests/libqos/usb.c +++ b/tests/libqos/usb.c @@ -11,10 +11,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "hw/usb/uhci-regs.h" #include "libqos/usb.h" diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c index b3e62e77d8..a4382f3660 100644 --- a/tests/libqos/virtio-mmio.c +++ b/tests/libqos/virtio-mmio.c @@ -7,8 +7,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-mmio.h" diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index f9fb924b8e..fde2ff0bcb 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -7,8 +7,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 3205b88d90..613decea5a 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -7,6 +7,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" #include "libqos/virtio.h" diff --git a/tests/libqtest.c b/tests/libqtest.c index fa314e1ee7..b12a9e4ca9 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -14,22 +14,14 @@ * See the COPYING file in the top-level directory. * */ +#include "qemu/osdep.h" #include "libqtest.h" #include <glib.h> -#include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> #include <sys/un.h> -#include <inttypes.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -#include "qemu/compiler.h" -#include "qemu/osdep.h" + #include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-streamer.h" #include "qapi/qmp/qjson.h" diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c index 71b4f28052..a751fd350e 100644 --- a/tests/m48t59-test.c +++ b/tests/m48t59-test.c @@ -12,11 +12,8 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h" diff --git a/tests/ne2000-test.c b/tests/ne2000-test.c index 61a678ad30..3727875f2e 100644 --- a/tests/ne2000-test.c +++ b/tests/ne2000-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop(void) diff --git a/tests/nvme-test.c b/tests/nvme-test.c index ff38b5e48f..ec06893eee 100644 --- a/tests/nvme-test.c +++ b/tests/nvme-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/pc-cpu-test.c b/tests/pc-cpu-test.c index 3505c7c43f..6b34ca588b 100644 --- a/tests/pc-cpu-test.c +++ b/tests/pc-cpu-test.c @@ -7,12 +7,11 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qapi/qmp/types.h" struct PCTestData { diff --git a/tests/pcnet-test.c b/tests/pcnet-test.c index 84af4f327a..2ddf4965c6 100644 --- a/tests/pcnet-test.c +++ b/tests/pcnet-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop(void) diff --git a/tests/pkix_asn1_tab.c b/tests/pkix_asn1_tab.c index 5b4e6b9e2d..903bc02518 100644 --- a/tests/pkix_asn1_tab.c +++ b/tests/pkix_asn1_tab.c @@ -3,6 +3,7 @@ * and is under copyright of various GNUTLS contributors. */ +#include "qemu/osdep.h" #include <libtasn1.h> const ASN1_ARRAY_TYPE pkix_asn1_tab[] = { diff --git a/tests/pvpanic-test.c b/tests/pvpanic-test.c index a7ad6b3064..d435833f79 100644 --- a/tests/pvpanic-test.c +++ b/tests/pvpanic-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void test_panic(void) { diff --git a/tests/q35-test.c b/tests/q35-test.c index 812abe5480..a105f10782 100644 --- a/tests/q35-test.c +++ b/tests/q35-test.c @@ -9,12 +9,11 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" -#include "qemu/osdep.h" #include "hw/pci-host/q35.h" static void smram_set_bit(QPCIDevice *pcidev, uint8_t mask, bool enabled) diff --git a/tests/qemu-iotests/socket_scm_helper.c b/tests/qemu-iotests/socket_scm_helper.c index 81959835eb..80cadf43bc 100644 --- a/tests/qemu-iotests/socket_scm_helper.c +++ b/tests/qemu-iotests/socket_scm_helper.c @@ -10,15 +10,9 @@ * See the COPYING.LIB file in the top-level directory. */ -#include <stdio.h> -#include <errno.h> +#include "qemu/osdep.h" #include <sys/socket.h> #include <sys/un.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> /* #define SOCKET_SCM_DEBUG */ diff --git a/tests/qom-test.c b/tests/qom-test.c index 3e5e8730e7..3c6cfca788 100644 --- a/tests/qom-test.c +++ b/tests/qom-test.c @@ -7,12 +7,11 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qapi/qmp/types.h" static const char *blacklist_x86[] = { diff --git a/tests/rcutorture.c b/tests/rcutorture.c index d6b304d000..244f0f28b2 100644 --- a/tests/rcutorture.c +++ b/tests/rcutorture.c @@ -60,13 +60,10 @@ * Test variables. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> #include "qemu/atomic.h" #include "qemu/rcu.h" -#include "qemu/compiler.h" #include "qemu/thread.h" long long n_reads = 0LL; diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 4243624de6..fa7029aa8a 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -11,11 +11,8 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h" #include "hw/timer/mc146818rtc_regs.h" diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c index ba62851cae..54e5aa7d0e 100644 --- a/tests/rtl8139-test.c +++ b/tests/rtl8139-test.c @@ -7,11 +7,10 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "libqos/pci-pc.h" -#include "qemu/osdep.h" #include "qemu/timer.h" #include "qemu-common.h" diff --git a/tests/spapr-phb-test.c b/tests/spapr-phb-test.c index b629de475a..f53911d9f7 100644 --- a/tests/spapr-phb-test.c +++ b/tests/spapr-phb-test.c @@ -7,6 +7,7 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" diff --git a/tests/tco-test.c b/tests/tco-test.c index 419f7cf46c..ac11175e90 100644 --- a/tests/tco-test.c +++ b/tests/tco-test.c @@ -6,10 +6,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include "libqtest.h" #include "libqos/pci.h" diff --git a/tests/test-aio.c b/tests/test-aio.c index 6ccea98977..a109bd0c42 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -10,6 +10,7 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "block/aio.h" #include "qemu/timer.h" diff --git a/tests/test-base64.c b/tests/test-base64.c index a0ca2d8de8..ae0c107c7d 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/base64.h" diff --git a/tests/test-bitops.c b/tests/test-bitops.c index 47b5d3ed9a..5050950607 100644 --- a/tests/test-bitops.c +++ b/tests/test-bitops.c @@ -6,9 +6,8 @@ * */ -#include <glib.h> -#include <stdint.h> #include "qemu/osdep.h" +#include <glib.h> #include "qemu/bitops.h" typedef struct { diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index 34747e924d..c866da66c8 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include "qapi/error.h" #include "qemu/main-loop.h" #include "block/blockjob.h" diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c index f5951cb1f1..dd4ced946c 100644 --- a/tests/test-coroutine.c +++ b/tests/test-coroutine.c @@ -11,6 +11,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/coroutine.h" #include "qemu/coroutine_int.h" diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c index c687307bcd..9f912eccb5 100644 --- a/tests/test-crypto-cipher.c +++ b/tests/test-crypto-cipher.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h" diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c index 3ec31dde7b..735d6d7e0b 100644 --- a/tests/test-crypto-hash.c +++ b/tests/test-crypto-hash.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h" diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c index a49c8e31e8..2bbc4d9e3c 100644 --- a/tests/test-crypto-secret.c +++ b/tests/test-crypto-secret.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h" diff --git a/tests/test-crypto-tlscredsx509.c b/tests/test-crypto-tlscredsx509.c index c70aa5563a..7ca387db65 100644 --- a/tests/test-crypto-tlscredsx509.c +++ b/tests/test-crypto-tlscredsx509.c @@ -18,10 +18,8 @@ * Author: Daniel P. Berrange <berrange@redhat.com> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "crypto/tlscredsx509.h" diff --git a/tests/test-crypto-tlssession.c b/tests/test-crypto-tlssession.c index 4524128fca..036a86b0c3 100644 --- a/tests/test-crypto-tlssession.c +++ b/tests/test-crypto-tlssession.c @@ -18,10 +18,8 @@ * Author: Daniel P. Berrange <berrange@redhat.com> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "crypto/tlscredsx509.h" #include "crypto/tlssession.h" diff --git a/tests/test-cutils.c b/tests/test-cutils.c index a3de6ab870..398700df45 100644 --- a/tests/test-cutils.c +++ b/tests/test-cutils.c @@ -25,9 +25,8 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> -#include <errno.h> -#include <string.h> #include "qemu-common.h" diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index abcea0cda6..abe1427917 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -9,10 +9,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> #include "qemu/hbitmap.h" #define LOG_BITS_PER_LONG (BITS_PER_LONG == 32 ? 5 : 6) diff --git a/tests/test-int128.c b/tests/test-int128.c index 0772ef7538..cacf6beac8 100644 --- a/tests/test-int128.c +++ b/tests/test-int128.c @@ -6,10 +6,9 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "qemu/int128.h" -#include "qemu/osdep.h" /* clang doesn't support __noclone__ but it does have a mechanism for * telling us this. We assume that if we don't have __has_attribute() diff --git a/tests/test-io-channel-buffer.c b/tests/test-io-channel-buffer.c index 6637501b41..64722a214b 100644 --- a/tests/test-io-channel-buffer.c +++ b/tests/test-io-channel-buffer.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include "io/channel-buffer.h" #include "io-channel-helpers.h" diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c index 03cac36a3f..885543760a 100644 --- a/tests/test-io-channel-command.c +++ b/tests/test-io-channel-command.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include "io/channel-command.h" #include "io-channel-helpers.h" diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c index f276a32de0..1e7f3c7f12 100644 --- a/tests/test-io-channel-file.c +++ b/tests/test-io-channel-file.c @@ -18,7 +18,9 @@ * */ +#include "qemu/osdep.h" #include "io/channel-file.h" +#include "io/channel-util.h" #include "io-channel-helpers.h" @@ -49,6 +51,26 @@ static void test_io_channel_file(void) } +static void test_io_channel_fd(void) +{ + QIOChannel *ioc; + int fd = -1; + +#define TEST_FILE "tests/test-io-channel-file.txt" + fd = open(TEST_FILE, O_CREAT | O_TRUNC | O_WRONLY, 0600); + g_assert_cmpint(fd, >, -1); + + ioc = qio_channel_new_fd(fd, &error_abort); + + g_assert_cmpstr(object_get_typename(OBJECT(ioc)), + ==, + TYPE_QIO_CHANNEL_FILE); + + unlink(TEST_FILE); + object_unref(OBJECT(ioc)); +} + + #ifndef _WIN32 static void test_io_channel_pipe(bool async) { @@ -92,6 +114,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_test_add_func("/io/channel/file", test_io_channel_file); + g_test_add_func("/io/channel/file/fd", test_io_channel_fd); #ifndef _WIN32 g_test_add_func("/io/channel/pipe/sync", test_io_channel_pipe_sync); g_test_add_func("/io/channel/pipe/async", test_io_channel_pipe_async); diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index 1a36a3c696..069736373c 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -18,7 +18,9 @@ * */ +#include "qemu/osdep.h" #include "io/channel-socket.h" +#include "io/channel-util.h" #include "io-channel-helpers.h" #ifdef HAVE_IFADDRS_H #include <ifaddrs.h> @@ -473,6 +475,24 @@ static void test_io_channel_unix_fd_pass(void) #endif /* _WIN32 */ +static void test_io_channel_ipv4_fd(void) +{ + QIOChannel *ioc; + int fd = -1; + + fd = socket(AF_INET, SOCK_STREAM, 0); + g_assert_cmpint(fd, >, -1); + + ioc = qio_channel_new_fd(fd, &error_abort); + + g_assert_cmpstr(object_get_typename(OBJECT(ioc)), + ==, + TYPE_QIO_CHANNEL_SOCKET); + + object_unref(OBJECT(ioc)); +} + + int main(int argc, char **argv) { bool has_ipv4, has_ipv6; @@ -495,6 +515,8 @@ int main(int argc, char **argv) test_io_channel_ipv4_sync); g_test_add_func("/io/channel/socket/ipv4-async", test_io_channel_ipv4_async); + g_test_add_func("/io/channel/socket/ipv4-fd", + test_io_channel_ipv4_fd); } if (has_ipv6) { g_test_add_func("/io/channel/socket/ipv6-sync", diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c index 3c11a5097c..3c361a7bef 100644 --- a/tests/test-io-channel-tls.c +++ b/tests/test-io-channel-tls.c @@ -21,10 +21,8 @@ */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "io/channel-tls.h" #include "io/channel-socket.h" diff --git a/tests/test-io-task.c b/tests/test-io-task.c index 3344382c7f..ae46c56a47 100644 --- a/tests/test-io-task.c +++ b/tests/test-io-task.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "io/task.h" diff --git a/tests/test-iov.c b/tests/test-iov.c index 46e4dddc55..3f25268dd4 100644 --- a/tests/test-iov.c +++ b/tests/test-iov.c @@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qemu/iov.h" diff --git a/tests/test-mul64.c b/tests/test-mul64.c index a0a17f7775..1282ec5a22 100644 --- a/tests/test-mul64.c +++ b/tests/test-mul64.c @@ -6,10 +6,9 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "qemu/host-utils.h" -#include "qemu/osdep.h" typedef struct { diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c index 303deb7e09..7d105c3232 100644 --- a/tests/test-netfilter.c +++ b/tests/test-netfilter.c @@ -8,6 +8,7 @@ * later. See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 9600b97012..b7acf7d294 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/config-file.h" /* qemu_add_opts() */ diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index 07c182338b..f0cc31e113 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -22,8 +22,8 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "hw/qdev.h" #include "qom/object.h" diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c index 0c1136d1b2..848374e2bd 100644 --- a/tests/test-qemu-opts.c +++ b/tests/test-qemu-opts.c @@ -7,12 +7,11 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qapi/error.h" +#include "qemu/osdep.h" #include "qapi/qmp/qstring.h" #include "qemu/config-file.h" #include <glib.h> -#include <string.h> static QemuOptsList opts_list_01 = { .name = "opts_list_01", diff --git a/tests/test-qga.c b/tests/test-qga.c index e6a84d17f0..0973b487d2 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -1,18 +1,11 @@ +#include "qemu/osdep.h" #include <locale.h> #include <glib.h> #include <glib/gstdio.h> -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> -#include <unistd.h> -#include <inttypes.h> #include "libqtest.h" -#include "config-host.h" #include "qga/guest-agent-core.h" typedef struct { diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c index 4d267b6a83..d6171f2d44 100644 --- a/tests/test-qmp-commands.c +++ b/tests/test-qmp-commands.c @@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qapi/qmp/types.h" diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 035c65cfdf..a296fdbac2 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -11,8 +11,8 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "test-qapi-types.h" diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 775ad39d93..6a33aa41e5 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -11,8 +11,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp-input-visitor.h" diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index f6bd408db3..c72cdad563 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp-input-visitor.h" diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index 26dc752b81..965f298e11 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c index daa8bf41db..79d3750144 100644 --- a/tests/test-rcu-list.c +++ b/tests/test-rcu-list.c @@ -20,14 +20,10 @@ * Copyright (c) 2013 Mike D. Day, IBM Corporation. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> #include "qemu/atomic.h" #include "qemu/rcu.h" -#include "qemu/compiler.h" -#include "qemu/osdep.h" #include "qemu/thread.h" #include "qemu/rcu_queue.h" diff --git a/tests/test-rfifolock.c b/tests/test-rfifolock.c index 0572ebb42a..9a3cb243ba 100644 --- a/tests/test-rfifolock.c +++ b/tests/test-rfifolock.c @@ -10,6 +10,7 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qemu/rfifolock.h" diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index d99498d098..4b48ec25d3 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/string-input-visitor.h" diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c index 4f4450fe70..0beccf98c7 100644 --- a/tests/test-string-output-visitor.c +++ b/tests/test-string-output-visitor.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c index ccdee39993..40600b40bb 100644 --- a/tests/test-thread-pool.c +++ b/tests/test-thread-pool.c @@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "block/aio.h" diff --git a/tests/test-throttle.c b/tests/test-throttle.c index a95039fdbf..858f1aa43f 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -12,6 +12,7 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include <math.h> #include "block/aio.h" diff --git a/tests/test-timed-average.c b/tests/test-timed-average.c index a049799b80..1cc4ab3027 100644 --- a/tests/test-timed-average.c +++ b/tests/test-timed-average.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <unistd.h> #include "qemu/timed-average.h" diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c index f74a6df97b..ef4dac5e01 100644 --- a/tests/test-visitor-serialization.c +++ b/tests/test-visitor-serialization.c @@ -11,9 +11,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdint.h> #include <float.h> #include "qemu-common.h" diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 4d13bd09b3..713d4443b2 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" diff --git a/tests/test-write-threshold.c b/tests/test-write-threshold.c index faffa7b855..fdbc8020fd 100644 --- a/tests/test-write-threshold.c +++ b/tests/test-write-threshold.c @@ -6,8 +6,8 @@ * */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "block/block_int.h" #include "block/write-threshold.h" diff --git a/tests/test-x86-cpuid.c b/tests/test-x86-cpuid.c index 6cd20d4a23..8eb0bc6ad5 100644 --- a/tests/test-x86-cpuid.c +++ b/tests/test-x86-cpuid.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> #include "hw/i386/topology.h" diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c index 1cd8cb7d78..abd309d418 100644 --- a/tests/test-xbzrle.c +++ b/tests/test-xbzrle.c @@ -10,11 +10,7 @@ * See the COPYING file in the top-level directory. * */ -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/time.h> +#include "qemu/osdep.h" #include "qemu-common.h" #include "include/migration/migration.h" diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c index 99db538191..235cae0137 100644 --- a/tests/tmp105-test.c +++ b/tests/tmp105-test.c @@ -7,6 +7,7 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" diff --git a/tests/tpci200-test.c b/tests/tpci200-test.c index 9ae01277ee..cb2b00ca8b 100644 --- a/tests/tpci200-test.c +++ b/tests/tpci200-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 9fb09f1df4..9a1ad5a1bb 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -29,23 +29,13 @@ #define _FILE_OFFSET_BITS 64 -#include <stddef.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <inttypes.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <sys/types.h> +#include "qemu/osdep.h" #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 <ctype.h> #include <netdb.h> #include <linux/vhost.h> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index e30b7f4abc..69615968ce 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -8,6 +8,7 @@ * */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" diff --git a/tests/virtio-balloon-test.c b/tests/virtio-balloon-test.c index becebb51a7..b010ce98e8 100644 --- a/tests/virtio-balloon-test.c +++ b/tests/virtio-balloon-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop(void) diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 4078321a20..3a66630d79 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -8,11 +8,8 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" diff --git a/tests/virtio-console-test.c b/tests/virtio-console-test.c index 6be96e8c64..0b9c2a55ef 100644 --- a/tests/virtio-console-test.c +++ b/tests/virtio-console-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void console_pci_nop(void) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 982d77a14b..04cfcd594e 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -7,12 +7,11 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "qemu-common.h" #include "qemu/sockets.h" -#include "qemu/osdep.h" #include "qemu/iov.h" #include "libqos/pci-pc.h" #include "libqos/virtio.h" diff --git a/tests/virtio-rng-test.c b/tests/virtio-rng-test.c index 41c1cdb1aa..771dbd73af 100644 --- a/tests/virtio-rng-test.c +++ b/tests/virtio-rng-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "libqos/pci.h" #define PCI_SLOT_HP 0x06 diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 66d8491e9d..d78747a466 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -8,11 +8,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" -#include <stdio.h> #include "block/scsi.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c index bf030a6162..480d4abb2d 100644 --- a/tests/virtio-serial-test.c +++ b/tests/virtio-serial-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop(void) diff --git a/tests/vmxnet3-test.c b/tests/vmxnet3-test.c index a2ebed39cc..6ef0e2f043 100644 --- a/tests/vmxnet3-test.c +++ b/tests/vmxnet3-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/wdt_ib700-test.c b/tests/wdt_ib700-test.c index 82ca597252..efe3370453 100644 --- a/tests/wdt_ib700-test.c +++ b/tests/wdt_ib700-test.c @@ -7,10 +7,9 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "qemu/timer.h" static void qmp_check_no_event(void) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index d844387b79..7615be4e7a 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -26,15 +26,6 @@ * THE SOFTWARE. */ -/* The following block of code temporarily renames the daemon() function so the - compiler does not see the warning associated with it in stdlib.h on OSX */ -#ifdef __APPLE__ -#define daemon qemu_fake_daemon_function -#include <stdlib.h> -#undef daemon -extern int daemon(int, int); -#endif - #if defined(__linux__) && (defined(__x86_64__) || defined(__arm__)) /* Use 2 MiB alignment so transparent hugepages can be used by KVM. Valgrind does not support alignments larger than 1 MiB, |