diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-03-23 19:57:40 +0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-06 14:31:55 +0200 |
commit | e9c4e0a8e54008bd83459777c8b8f5a38ff6fea2 (patch) | |
tree | 2bd025c0f97e1b7438eea309dc85449fa5fee88e /util | |
parent | 69242e7e7ea55f2a3f4fa50e367cad849c9cdc36 (diff) | |
download | qemu-e9c4e0a8e54008bd83459777c8b8f5a38ff6fea2.zip qemu-e9c4e0a8e54008bd83459777c8b8f5a38ff6fea2.tar.gz qemu-e9c4e0a8e54008bd83459777c8b8f5a38ff6fea2.tar.bz2 |
Move fcntl_setfl() to oslib-posix
It is only implemented for POSIX anyway.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220323155743.1585078-30-marcandre.lureau@redhat.com>
[Add braces around if statements. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/cutils.c | 17 | ||||
-rw-r--r-- | util/oslib-posix.c | 15 |
2 files changed, 15 insertions, 17 deletions
diff --git a/util/cutils.c b/util/cutils.c index 1173ce3..aaf2ced 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -199,23 +199,6 @@ int qemu_msync(void *addr, size_t length, int fd) #endif /* CONFIG_POSIX */ } -#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 - static int64_t suffix_mul(char suffix, int64_t unit) { switch (qemu_toupper(suffix)) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 577c855..a069dbf 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -936,3 +936,18 @@ size_t qemu_get_host_physmem(void) #endif return 0; } + +/* 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; +} |