aboutsummaryrefslogtreecommitdiff
path: root/slirp/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/util.c')
-rw-r--r--slirp/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/slirp/util.c b/slirp/util.c
index b1a36b27bc..59f6713c8b 100644
--- a/slirp/util.c
+++ b/slirp/util.c
@@ -43,6 +43,20 @@ int inet_aton(const char *cp, struct in_addr *ia)
}
#endif
+void slirp_set_nonblock(int fd)
+{
+#ifndef _WIN32
+ int f;
+ f = fcntl(fd, F_GETFL);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
+ assert(f != -1);
+#else
+ unsigned long opt = 1;
+ ioctlsocket(fd, FIONBIO, &opt);
+#endif
+}
+
static void slirp_set_cloexec(int fd)
{
#ifndef _WIN32