[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/40] util/compatfd.c: use libc signalfd wrapper instead of raw s
From: |
Paolo Bonzini |
Subject: |
[PULL 05/40] util/compatfd.c: use libc signalfd wrapper instead of raw syscall |
Date: |
Wed, 13 Oct 2021 11:06:53 +0200 |
From: Kacper Słomiński <kacper.slominski72@gmail.com>
This allows the use of native signalfd instead of the sigtimedwait
based emulation on systems other than Linux.
Signed-off-by: Kacper Słomiński <kacper.slominski72@gmail.com>
Message-Id: <20210905011621.200785-1-kacper.slominski72@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 7 +++----
util/compatfd.c | 5 ++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/meson.build b/meson.build
index 99a0a3e689..2d373a61a6 100644
--- a/meson.build
+++ b/meson.build
@@ -1420,10 +1420,9 @@ config_host_data.set('CONFIG_POSIX_MADVISE',
cc.links(gnu_source_prefix + '''
#include <stddef.h>
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }'''))
config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + '''
- #include <unistd.h>
- #include <sys/syscall.h>
- #include <signal.h>
- int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }'''))
+ #include <sys/signalfd.h>
+ #include <stddef.h>
+ int main(void) { return signalfd(-1, NULL, SFD_CLOEXEC); }'''))
config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + '''
#include <unistd.h>
#include <fcntl.h>
diff --git a/util/compatfd.c b/util/compatfd.c
index a8ec525c6c..ab810c42a9 100644
--- a/util/compatfd.c
+++ b/util/compatfd.c
@@ -17,7 +17,7 @@
#include "qemu/thread.h"
#if defined(CONFIG_SIGNALFD)
-#include <sys/syscall.h>
+#include <sys/signalfd.h>
#endif
struct sigfd_compat_info {
@@ -96,9 +96,8 @@ int qemu_signalfd(const sigset_t *mask)
#if defined(CONFIG_SIGNALFD)
int ret;
- ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8);
+ ret = signalfd(-1, mask, SFD_CLOEXEC);
if (ret != -1) {
- qemu_set_cloexec(ret);
return ret;
}
#endif
--
2.31.1
- [PULL 00/40] Misc patches for 2021-10-13, Paolo Bonzini, 2021/10/13
- [PULL 02/40] tests: add missing dependency for check-block, Paolo Bonzini, 2021/10/13
- [PULL 01/40] MAINTAINERS: Add myself as reviewer of the 'Memory API', Paolo Bonzini, 2021/10/13
- [PULL 09/40] target/i386/kvm: Restrict SEV stubs to x86 architecture, Paolo Bonzini, 2021/10/13
- [PULL 04/40] qemu-iotests: flush after every test, Paolo Bonzini, 2021/10/13
- [PULL 08/40] target/i386/kvm: Introduce i386_softmmu_kvm Meson source set, Paolo Bonzini, 2021/10/13
- [PULL 20/40] target/i386/sev: Declare system-specific functions in 'sev.h', Paolo Bonzini, 2021/10/13
- [PULL 05/40] util/compatfd.c: use libc signalfd wrapper instead of raw syscall,
Paolo Bonzini <=
- [PULL 03/40] build: fix "make check" without earlier "make", Paolo Bonzini, 2021/10/13
- [PULL 07/40] qapi/misc-target: Group SEV QAPI definitions, Paolo Bonzini, 2021/10/13
- [PULL 10/40] target/i386/sev: Prefix QMP errors with 'SEV', Paolo Bonzini, 2021/10/13
- [PULL 17/40] target/i386/sev: Use g_autofree in sev_launch_get_measure(), Paolo Bonzini, 2021/10/13
- [PULL 22/40] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c, Paolo Bonzini, 2021/10/13
- [PULL 06/40] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines, Paolo Bonzini, 2021/10/13
- [PULL 11/40] target/i386/monitor: Return QMP error when SEV is not enabled for guest, Paolo Bonzini, 2021/10/13
- [PULL 14/40] target/i386/sev: Remove sev_get_me_mask(), Paolo Bonzini, 2021/10/13
- [PULL 19/40] target/i386/sev: Rename sev_i386.h -> sev.h, Paolo Bonzini, 2021/10/13
- [PULL 25/40] target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c, Paolo Bonzini, 2021/10/13