]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
add socket_set_block
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 5 Oct 2011 07:17:32 +0000 (09:17 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 21 Oct 2011 15:34:12 +0000 (17:34 +0200)
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
oslib-posix.c
oslib-win32.c
qemu_socket.h

index a304fb0f53677b83aa3745a11ba5ac14b00c7af2..dbc8ee896036190e5efdc10655766007431cd3ab 100644 (file)
@@ -103,6 +103,13 @@ void qemu_vfree(void *ptr)
     free(ptr);
 }
 
+void socket_set_block(int fd)
+{
+    int f;
+    f = fcntl(fd, F_GETFL);
+    fcntl(fd, F_SETFL, f & ~O_NONBLOCK);
+}
+
 void socket_set_nonblock(int fd)
 {
     int f;
index 5f0759ffc48435cc504a62fdb5381fd9cc00b855..5e3de7dc8a52cf1b6131d8764f97ec4e23a5c3c3 100644 (file)
@@ -73,6 +73,12 @@ void qemu_vfree(void *ptr)
     VirtualFree(ptr, 0, MEM_RELEASE);
 }
 
+void socket_set_block(int fd)
+{
+    unsigned long opt = 0;
+    ioctlsocket(fd, FIONBIO, &opt);
+}
+
 void socket_set_nonblock(int fd)
 {
     unsigned long opt = 1;
index 180e4dbd9b5bebe927fb624f8463d384bd3adc24..9e32fac65106188186c4cf4d361a16047de416c6 100644 (file)
@@ -35,6 +35,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
 /* misc helpers */
 int qemu_socket(int domain, int type, int protocol);
 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+void socket_set_block(int fd);
 void socket_set_nonblock(int fd);
 int send_all(int fd, const void *buf, int len1);