aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-09-16 22:51:16 -0700
committerAvi Kivity <avi@redhat.com>2008-09-16 23:04:54 -0700
commitdc03f04b0ef5d109d9b4bbb102dbe4898ca6974d (patch)
tree6a269dee67fa5e76bd3c6ac1c8a0f76e1f34af28 /osdep.c
parentkvm: external module: intel iommu compatibility (diff)
parenttarget-alpha: small optimizations (diff)
downloadqemu-kvm-dc03f04b0ef5d109d9b4bbb102dbe4898ca6974d.tar.gz
qemu-kvm-dc03f04b0ef5d109d9b4bbb102dbe4898ca6974d.tar.bz2
qemu-kvm-dc03f04b0ef5d109d9b4bbb102dbe4898ca6974d.zip
Merge branch 'qemu-cvs'
Conflicts: qemu/block-raw-posix.c qemu/hw/pc.c qemu/monitor.c qemu/vl.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/osdep.c b/osdep.c
index 367248610..bcda2169d 100644
--- a/osdep.c
+++ b/osdep.c
@@ -45,6 +45,8 @@
#include <malloc.h>
#endif
+#include "qemu_socket.h"
+
#if defined(_WIN32)
void *qemu_memalign(size_t alignment, size_t size)
{
@@ -287,3 +289,28 @@ int qemu_gettimeofday(qemu_timeval *tp)
return 0;
}
#endif /* _WIN32 */
+
+
+#ifdef _WIN32
+void socket_set_nonblock(int fd)
+{
+ unsigned long opt = 1;
+ ioctlsocket(fd, FIONBIO, &opt);
+}
+
+int inet_aton(const char *cp, struct in_addr *ia)
+{
+ uint32_t addr = inet_addr(cp);
+ if (addr == 0xffffffff)
+ return 0;
+ ia->s_addr = addr;
+ return 1;
+}
+#else
+void socket_set_nonblock(int fd)
+{
+ int f;
+ f = fcntl(fd, F_GETFL);
+ fcntl(fd, F_SETFL, f | O_NONBLOCK);
+}
+#endif