]> git.proxmox.com Git - qemu.git/blobdiff - slirp/misc.c
qdev-properties-system.c: Allow vlan or netdev for -device, not both
[qemu.git] / slirp / misc.c
index 0308a62fac1750de87323e7cd5f60012bf8f1270..6c1636f7b6d6acf424cd3e6070f00499c42d408a 100644 (file)
@@ -8,7 +8,8 @@
 #include <slirp.h>
 #include <libslirp.h>
 
-#include "monitor.h"
+#include "monitor/monitor.h"
+#include "qemu/main-loop.h"
 
 #ifdef DEBUG
 int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR;
@@ -211,11 +212,10 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
                     so->s = accept(s, (struct sockaddr *)&addr, &addrlen);
                 } while (so->s < 0 && errno == EINTR);
                 closesocket(s);
+                socket_set_fast_reuse(so->s);
                 opt = 1;
-                setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int));
-                opt = 1;
-                setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, (char *)&opt, sizeof(int));
-               fd_nonblock(so->s);
+                qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
+               qemu_set_nonblock(so->s);
 
                /* Append the telnet options now */
                 if (so->so_m != NULL && do_pty == 1)  {
@@ -242,8 +242,6 @@ strdup(str)
 }
 #endif
 
-#include "monitor.h"
-
 void lprint(const char *format, ...)
 {
     va_list args;
@@ -253,64 +251,6 @@ void lprint(const char *format, ...)
     va_end(args);
 }
 
-void
-u_sleep(int usec)
-{
-       struct timeval t;
-       fd_set fdset;
-
-       FD_ZERO(&fdset);
-
-       t.tv_sec = 0;
-       t.tv_usec = usec * 1000;
-
-       select(0, &fdset, &fdset, &fdset, &t);
-}
-
-/*
- * Set fd blocking and non-blocking
- */
-
-void
-fd_nonblock(int fd)
-{
-#ifdef FIONBIO
-#ifdef _WIN32
-        unsigned long opt = 1;
-#else
-        int opt = 1;
-#endif
-
-       ioctlsocket(fd, FIONBIO, &opt);
-#else
-       int opt;
-
-       opt = fcntl(fd, F_GETFL, 0);
-       opt |= O_NONBLOCK;
-       fcntl(fd, F_SETFL, opt);
-#endif
-}
-
-void
-fd_block(int fd)
-{
-#ifdef FIONBIO
-#ifdef _WIN32
-        unsigned long opt = 0;
-#else
-       int opt = 0;
-#endif
-
-       ioctlsocket(fd, FIONBIO, &opt);
-#else
-       int opt;
-
-       opt = fcntl(fd, F_GETFL, 0);
-       opt &= ~O_NONBLOCK;
-       fcntl(fd, F_SETFL, opt);
-#endif
-}
-
 void slirp_connection_info(Slirp *slirp, Monitor *mon)
 {
     const char * const tcpstates[] = {