treewide: use qemu_set_blocking instead of g_unix_set_fd_nonblocking

Instead of open-coded g_unix_set_fd_nonblocking() calls, use
QEMU wrapper qemu_set_blocking().

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
[DB: fix missing closing ) in tap-bsd.c, remove now unused GError var]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy
2025-09-16 16:13:59 +03:00
committed by Daniel P. Berrangé
parent 5d1d32ce9d
commit 6f607941b1
21 changed files with 67 additions and 55 deletions
+5 -2
View File
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/event_notifier.h"
#include "qemu/main-loop.h"
@@ -36,6 +37,7 @@ int event_notifier_init(EventNotifier *e, int active)
{
int fds[2];
int ret;
Error *local_err = NULL;
#ifdef CONFIG_EVENTFD
ret = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
@@ -52,11 +54,11 @@ int event_notifier_init(EventNotifier *e, int active)
if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) {
return -errno;
}
if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) {
if (!qemu_set_blocking(fds[0], false, &local_err)) {
ret = -errno;
goto fail;
}
if (!g_unix_set_fd_nonblocking(fds[1], true, NULL)) {
if (!qemu_set_blocking(fds[1], false, &local_err)) {
ret = -errno;
goto fail;
}
@@ -70,6 +72,7 @@ int event_notifier_init(EventNotifier *e, int active)
return 0;
fail:
error_report_err(local_err);
close(fds[0]);
close(fds[1]);
return ret;
+4 -1
View File
@@ -114,7 +114,10 @@ static int qemu_signal_init(Error **errp)
return -errno;
}
g_unix_set_fd_nonblocking(sigfd, true, NULL);
if (!qemu_set_blocking(sigfd, false, errp)) {
close(sigfd);
return -EINVAL;
}
qemu_set_fd_handler(sigfd, sigfd_handler, NULL, (void *)(intptr_t)sigfd);