From db1a49726c3c6cbe9cbca5b118e80c0fec65e8dd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 10 Mar 2010 11:38:55 +0100 Subject: split out qemu-timer.c Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- cutils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'cutils.c') diff --git a/cutils.c b/cutils.c index 2365e68d9d..036ae3ce31 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 + -- cgit v1.2.3