[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V8 13/39] oslib: qemu_clear_cloexec
From: |
Steve Sistare |
Subject: |
[PATCH V8 13/39] oslib: qemu_clear_cloexec |
Date: |
Wed, 15 Jun 2022 07:52:00 -0700 |
Define qemu_clear_cloexec, analogous to qemu_set_cloexec.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
include/qemu/osdep.h | 1 +
util/oslib-posix.c | 9 +++++++++
util/oslib-win32.c | 4 ++++
3 files changed, 14 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index b1c161c..e916f3b 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -548,6 +548,7 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t
count)
G_GNUC_WARN_UNUSED_RESULT;
void qemu_set_cloexec(int fd);
+void qemu_clear_cloexec(int fd);
/* Return a dynamically allocated directory path that is appropriate for
storing
* local state.
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 7a34c16..421e987 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -261,6 +261,15 @@ void qemu_set_cloexec(int fd)
assert(f != -1);
}
+void qemu_clear_cloexec(int fd)
+{
+ int f;
+ f = fcntl(fd, F_GETFD);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFD, f & ~FD_CLOEXEC);
+ assert(f != -1);
+}
+
char *
qemu_get_local_state_dir(void)
{
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 5723d3e..5bed148 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -226,6 +226,10 @@ void qemu_set_cloexec(int fd)
{
}
+void qemu_clear_cloexec(int fd)
+{
+}
+
int qemu_get_thread_id(void)
{
return GetCurrentThreadId();
--
1.8.3.1
- Re: [PATCH V8 06/39] cpr: reboot mode, (continued)
- [PATCH V8 02/39] migration: qemu file wrappers, Steve Sistare, 2022/06/15
- [PATCH V8 08/39] cpr: blockers, Steve Sistare, 2022/06/15
- [PATCH V8 10/39] cpr: cpr-enable option, Steve Sistare, 2022/06/15
- [PATCH V8 12/39] memory: flat section iterator, Steve Sistare, 2022/06/15
- [PATCH V8 09/39] cpr: register blockers, Steve Sistare, 2022/06/15
- [PATCH V8 11/39] cpr: save ram blocks, Steve Sistare, 2022/06/15
- [PATCH V8 13/39] oslib: qemu_clear_cloexec,
Steve Sistare <=
- [PATCH V8 25/39] cpr: notifiers, Steve Sistare, 2022/06/15
- [PATCH V8 20/39] cpr: restart mode, Steve Sistare, 2022/06/15
- [PATCH V8 29/39] vfio-pci: cpr part 3 (intx), Steve Sistare, 2022/06/15
- [PATCH V8 17/39] qapi: strList unit tests, Steve Sistare, 2022/06/15
- [PATCH V8 14/39] qapi: strList_from_string, Steve Sistare, 2022/06/15