summaryrefslogtreecommitdiff
path: root/cutils.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-03-10 11:38:55 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-17 11:16:15 -0500
commitdb1a49726c3c6cbe9cbca5b118e80c0fec65e8dd (patch)
treedc4f42c9d7476e43f8a0c5547e31c193b71fbe96 /cutils.c
parentd6f4ade214a9f74dca9495b83a24ff9c113e4f9a (diff)
split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/cutils.c b/cutils.c
index 2365e68d9..036ae3ce3 100644
--- a/cutils.c
+++ b/cutils.c
@@ -233,3 +233,21 @@ void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count)
count -= copy;
}
}
+
+#ifndef _WIN32
+/* Sets a specific flag */
+int fcntl_setfl(int fd, int flag)
+{
+ int flags;
+
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1)
+ return -errno;
+
+ if (fcntl(fd, F_SETFL, flags | flag) == -1)
+ return -errno;
+
+ return 0;
+}
+#endif
+