aboutsummaryrefslogtreecommitdiff
path: root/oslib-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'oslib-posix.c')
-rw-r--r--oslib-posix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/oslib-posix.c b/oslib-posix.c
index df97304..aebe3ac 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -29,6 +29,7 @@
#include "config-host.h"
#include "sysemu.h"
#include "trace.h"
+#include "qemu_socket.h"
#if !defined(_POSIX_C_SOURCE) || defined(__sun__)
static void *oom_check(void *ptr)
@@ -72,3 +73,17 @@ void qemu_vfree(void *ptr)
trace_qemu_vfree(ptr);
free(ptr);
}
+
+void socket_set_nonblock(int fd)
+{
+ int f;
+ f = fcntl(fd, F_GETFL);
+ fcntl(fd, F_SETFL, f | O_NONBLOCK);
+}
+
+void qemu_set_cloexec(int fd)
+{
+ int f;
+ f = fcntl(fd, F_GETFD);
+ fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+}