diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-21 12:01:06 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-29 10:52:36 +0200 |
commit | 9adea5f7f7a23ef4a1231289a36a94c52347b142 (patch) | |
tree | 5fb89a0ceb3cee9f8a81c5f4187a5080991117c2 /include | |
parent | c12915e638a31010923b8dbbf8ce06f564a175f9 (diff) |
win32: add readv/writev emulation
Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27)
introduced a usage of writev, which mingw32 does not have. Even though
qemu_fdopen itself is not used on mingw32, the future-proof solution is
to add an implementation of it. This is simple and similar to how we
emulate sendmsg/recvmsg in util/iov.c.
Some files include osdep.h without qemu-common.h, so move the definition
of iovec to osdep.h too, and include osdep.h from qemu-common.h
unconditionally (protection against including files when NEED_CPU_H is
defined is not needed since the removal of AREG0).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu-common.h | 22 | ||||
-rw-r--r-- | include/qemu/osdep.h | 17 |
2 files changed, 19 insertions, 20 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h index a39cdba27f..b399d855c1 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -84,20 +84,6 @@ # error Unknown pointer size #endif -#ifndef CONFIG_IOVEC -#define CONFIG_IOVEC -struct iovec { - void *iov_base; - size_t iov_len; -}; -/* - * Use the same value as Linux for now. - */ -#define IOV_MAX 1024 -#else -#include <sys/uio.h> -#endif - typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) GCC_FMT_ATTR(2, 3); @@ -122,16 +108,12 @@ static inline char *realpath(const char *path, char *resolved_path) void configure_icount(const char *option); extern int use_icount; -/* FIXME: Remove NEED_CPU_H. */ -#ifndef NEED_CPU_H - #include "qemu/osdep.h" #include "qemu/bswap.h" -#else - +/* FIXME: Remove NEED_CPU_H. */ +#ifdef NEED_CPU_H #include "cpu.h" - #endif /* !defined(NEED_CPU_H) */ /* main function, renamed */ diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 8b465fdf2f..42545bcbdb 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -1,6 +1,7 @@ #ifndef QEMU_OSDEP_H #define QEMU_OSDEP_H +#include "config-host.h" #include <stdarg.h> #include <stddef.h> #include <stdbool.h> @@ -161,6 +162,22 @@ int qemu_close(int fd); int qemu_create_pidfile(const char *filename); int qemu_get_thread_id(void); +#ifndef CONFIG_IOVEC +struct iovec { + void *iov_base; + size_t iov_len; +}; +/* + * Use the same value as Linux for now. + */ +#define IOV_MAX 1024 + +ssize_t readv(int fd, const struct iovec *iov, int iov_cnt); +ssize_t writev(int fd, const struct iovec *iov, int iov_cnt); +#else +#include <sys/uio.h> +#endif + #ifdef _WIN32 static inline void qemu_timersub(const struct timeval *val1, const struct timeval *val2, |