aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-07-21 19:55:03 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-07-21 20:05:51 +0100
commitac1ecbe45a3ebdd7a0aab3ea1001892e5d8ba6bb (patch)
tree1f7a6aa50047345fb6e13c29cd37cc78ca9b9b8b
parent5e54d2b7e75af8edce0b2947e76ef1cb98c9aca8 (diff)
osdep.h: Move some OS header includes and fixups from qemu-common.h
qemu-common.h has some system header includes and fixups for things that might be missing. This is really an OS dependency and belongs in osdep.h, so move it across. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/qemu-common.h55
-rw-r--r--include/qemu/osdep.h49
2 files changed, 49 insertions, 55 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 9e622a53f2..de4ae53d6d 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -12,8 +12,7 @@
#ifndef QEMU_COMMON_H
#define QEMU_COMMON_H
-#include "qemu/compiler.h"
-#include "config-host.h"
+#include "qemu/osdep.h"
#include "qemu/typedefs.h"
#include "qemu/fprintf-fn.h"
@@ -23,60 +22,9 @@
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
-/* we put basic includes here to avoid repeating them in device drivers */
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <string.h>
-#include <strings.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <time.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <assert.h>
-#include <signal.h>
#include "glib-compat.h"
#include "qemu/option.h"
-#ifdef _WIN32
-#include "sysemu/os-win32.h"
-#endif
-
-#ifdef CONFIG_POSIX
-#include "sysemu/os-posix.h"
-#endif
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-#ifndef ENOMEDIUM
-#define ENOMEDIUM ENODEV
-#endif
-#if !defined(ENOTSUP)
-#define ENOTSUP 4096
-#endif
-#if !defined(ECANCELED)
-#define ECANCELED 4097
-#endif
-#if !defined(EMEDIUMTYPE)
-#define EMEDIUMTYPE 4098
-#endif
-#ifndef TIME_MAX
-#define TIME_MAX LONG_MAX
-#endif
-
/* HOST_LONG_BITS is the size of a native pointer in bits. */
#if UINTPTR_MAX == UINT32_MAX
# define HOST_LONG_BITS 32
@@ -97,7 +45,6 @@ extern int64_t max_delay;
extern int64_t max_advance;
void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
-#include "qemu/osdep.h"
#include "qemu/bswap.h"
/* FIXME: Remove NEED_CPU_H. */
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 4ae2c64fa7..60ac27d195 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -8,6 +8,22 @@
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <time.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <assert.h>
+#include <signal.h>
+
#ifdef __OpenBSD__
#include <sys/signal.h>
#endif
@@ -19,7 +35,13 @@
#define WEXITSTATUS(x) (x)
#endif
-#include <sys/time.h>
+#ifdef _WIN32
+#include "sysemu/os-win32.h"
+#endif
+
+#ifdef CONFIG_POSIX
+#include "sysemu/os-posix.h"
+#endif
#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
/* [u]int_fast*_t not in <sys/int_types.h> */
@@ -28,6 +50,31 @@ typedef unsigned int uint_fast16_t;
typedef signed int int_fast16_t;
#endif
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+#ifndef ENOMEDIUM
+#define ENOMEDIUM ENODEV
+#endif
+#if !defined(ENOTSUP)
+#define ENOTSUP 4096
+#endif
+#if !defined(ECANCELED)
+#define ECANCELED 4097
+#endif
+#if !defined(EMEDIUMTYPE)
+#define EMEDIUMTYPE 4098
+#endif
+#ifndef TIME_MAX
+#define TIME_MAX LONG_MAX
+#endif
+
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif