Skip to content
Snippets Groups Projects
Commit 4d14cb0c authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

Use g_unix_set_fd_nonblocking()


API available since glib 2.30. It also preserves errno.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
parent c6d3bcb4
No related branches found
No related tags found
No related merge requests found
...@@ -537,7 +537,7 @@ static void process_msg_connect(IVShmemState *s, uint16_t posn, int fd, ...@@ -537,7 +537,7 @@ static void process_msg_connect(IVShmemState *s, uint16_t posn, int fd,
IVSHMEM_DPRINTF("eventfds[%d][%d] = %d\n", posn, vector, fd); IVSHMEM_DPRINTF("eventfds[%d][%d] = %d\n", posn, vector, fd);
event_notifier_init_fd(&peer->eventfds[vector], fd); event_notifier_init_fd(&peer->eventfds[vector], fd);
fcntl_setfl(fd, O_NONBLOCK); /* msix/irqfd poll non block */ g_unix_set_fd_nonblocking(fd, true, NULL); /* msix/irqfd poll non block */
if (posn == s->vm_id) { if (posn == s->vm_id) {
setup_interrupt(s, vector, errp); setup_interrupt(s, vector, errp);
......
...@@ -52,13 +52,11 @@ int event_notifier_init(EventNotifier *e, int active) ...@@ -52,13 +52,11 @@ int event_notifier_init(EventNotifier *e, int active)
if (qemu_pipe(fds) < 0) { if (qemu_pipe(fds) < 0) {
return -errno; return -errno;
} }
ret = fcntl_setfl(fds[0], O_NONBLOCK); if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) {
if (ret < 0) {
ret = -errno; ret = -errno;
goto fail; goto fail;
} }
ret = fcntl_setfl(fds[1], O_NONBLOCK); if (!g_unix_set_fd_nonblocking(fds[1], true, NULL)) {
if (ret < 0) {
ret = -errno; ret = -errno;
goto fail; goto fail;
} }
......
...@@ -114,7 +114,7 @@ static int qemu_signal_init(Error **errp) ...@@ -114,7 +114,7 @@ static int qemu_signal_init(Error **errp)
return -errno; return -errno;
} }
fcntl_setfl(sigfd, O_NONBLOCK); g_unix_set_fd_nonblocking(sigfd, true, NULL);
qemu_set_fd_handler(sigfd, sigfd_handler, NULL, (void *)(intptr_t)sigfd); qemu_set_fd_handler(sigfd, sigfd_handler, NULL, (void *)(intptr_t)sigfd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment