[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 29/32] Move fcntl_setfl() to oslib-posix
From: |
marcandre . lureau |
Subject: |
[PATCH 29/32] Move fcntl_setfl() to oslib-posix |
Date: |
Wed, 23 Mar 2022 19:57:40 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
It is only implemented for POSIX anyway.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/qemu/cutils.h | 1 -
include/sysemu/os-posix.h | 2 ++
util/cutils.c | 17 -----------------
util/oslib-posix.c | 15 +++++++++++++++
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index 2137e6526087..e873bad36674 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -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);
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index a49c6848ff1a..e9deb9b0c4b6 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -99,6 +99,8 @@ static inline void qemu_funlockfile(FILE *f)
funlockfile(f);
}
+int fcntl_setfl(int fd, int flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/util/cutils.c b/util/cutils.c
index 1173ce3b88f3..aaf2ced29142 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 577c855612cb..fae25be3e779 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;
+}
--
2.35.1.273.ge6ebfd0e8cbb
- [PATCH 21/32] include: move C/util-related declarations to cutils.h, (continued)
- [PATCH 21/32] include: move C/util-related declarations to cutils.h, marcandre . lureau, 2022/03/23
- [PATCH 22/32] include: move cpu_exec* declarations to cpu-common.h, marcandre . lureau, 2022/03/23
- [PATCH 23/32] include: move target page bits declaration to page-vary.h, marcandre . lureau, 2022/03/23
- [PATCH 24/32] include: move progress API to qemu-progress.h, marcandre . lureau, 2022/03/23
- [PATCH 25/32] include: move qemu_get_vm_name() to sysemu.h, marcandre . lureau, 2022/03/23
- [PATCH 26/32] include: move os_*() to os-foo.h, marcandre . lureau, 2022/03/23
- [PATCH 29/32] Move fcntl_setfl() to oslib-posix,
marcandre . lureau <=
- [PATCH 27/32] include: move page_size_init() to include/hw/core/cpu.h, marcandre . lureau, 2022/03/23
- [PATCH 28/32] Move CPU softfloat unions to cpu-float.h, marcandre . lureau, 2022/03/23
- [PATCH 30/32] qga: remove explicit environ argument from exec/spawn, marcandre . lureau, 2022/03/23
- [PATCH 31/32] RFC: Simplify softmmu/main.c, marcandre . lureau, 2022/03/23
- [PATCH 32/32] Remove qemu-common.h include from most units, marcandre . lureau, 2022/03/23