]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Move fcntl_setfl() to oslib-posix
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 23 Mar 2022 15:57:40 +0000 (19:57 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 6 Apr 2022 12:31:55 +0000 (14:31 +0200)
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>
include/qemu/cutils.h
include/sysemu/os-posix.h
util/cutils.c
util/oslib-posix.c

index 2137e6526087baf61289b9aa593eba254d0f3e49..e873bad366743c564fe233b8a7470a622ff0cc8c 100644 (file)
@@ -131,7 +131,6 @@ const char *qemu_strchrnul(const char *s, int c);
 time_t mktimegm(struct tm *tm);
 int qemu_fdatasync(int fd);
 int qemu_msync(void *addr, size_t length, int fd);
-int fcntl_setfl(int fd, int flag);
 int qemu_parse_fd(const char *param);
 int qemu_strtoi(const char *nptr, const char **endptr, int base,
                 int *result);
index 58de7c994d851d6331792256848c0666f7fb0f0e..adbe19d3e468f7f33607f829be4fa2c9fb130885 100644 (file)
@@ -96,6 +96,8 @@ static inline void qemu_funlockfile(FILE *f)
     funlockfile(f);
 }
 
+int fcntl_setfl(int fd, int flag);
+
 #ifdef __cplusplus
 }
 #endif
index 1173ce3b88f39fcdd05c3f6381a9e95085b747e8..aaf2ced29142b3f4a74c7804ae85b6a9f7a19c57 100644 (file)
@@ -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)) {
index 577c855612cb9c12340b1390def2af28373de78a..a069dbff6931804e612553d87352d37a03462fbe 100644 (file)
@@ -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;
+}