[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 16/32] oslib: add qemu_clr_cloexec
From: |
Steve Sistare |
Subject: |
[PATCH V1 16/32] oslib: add qemu_clr_cloexec |
Date: |
Thu, 30 Jul 2020 08:14:20 -0700 |
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 45c217a..bb28df1 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -551,6 +551,7 @@ static inline void qemu_timersub(const struct timeval *val1,
#endif
void qemu_set_cloexec(int fd);
+void qemu_clr_cloexec(int fd);
/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
* instead of QEMU_VERSION, so setting hw_version on MachineClass
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index d923674..28fee45 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -314,6 +314,15 @@ void qemu_set_cloexec(int fd)
assert(f != -1);
}
+void qemu_clr_cloexec(int fd)
+{
+ int f;
+ f = fcntl(fd, F_GETFD);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFD, f & ~FD_CLOEXEC);
+ assert(f != -1);
+}
+
/*
* Creates a pipe with FD_CLOEXEC set on both file descriptors
*/
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 7eedbe5..e5d0c7c 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -254,6 +254,10 @@ void qemu_set_cloexec(int fd)
{
}
+void qemu_clr_cloexec(int fd)
+{
+}
+
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
#define _W32_FT_OFFSET (116444736000000000ULL)
--
1.8.3.1
- Re: [PATCH V1 12/32] vl: pause option, (continued)
Re: [PATCH V1 12/32] vl: pause option, Alex Bennée, 2020/07/30
[PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart, Steve Sistare, 2020/07/30
[PATCH V1 15/32] vl: QEMU_START_FREEZE env var, Steve Sistare, 2020/07/30
[PATCH V1 16/32] oslib: add qemu_clr_cloexec,
Steve Sistare <=
[PATCH V1 17/32] util: env var helpers, Steve Sistare, 2020/07/30
[PATCH V1 20/32] vl: add helper to request re-exec, Steve Sistare, 2020/07/30
[PATCH V1 22/32] char: qio_channel_socket_accept reuse fd, Steve Sistare, 2020/07/30
[PATCH V1 28/32] char: restore terminal on restart, Steve Sistare, 2020/07/30
[PATCH V1 29/32] pci: export pci_update_mappings, Steve Sistare, 2020/07/30
[PATCH V1 25/32] char: save/restore chardev pty fds, Steve Sistare, 2020/07/30
[PATCH V1 24/32] ui: save/restore vnc socket fds, Steve Sistare, 2020/07/30
[PATCH V1 31/32] vfio-pci: trace pci config, Steve Sistare, 2020/07/30