diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-04-25 17:39:06 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-05-03 15:52:33 +0400 |
commit | 701544cfaf46f24d912ad1714eb24641c3c96837 (patch) | |
tree | f9d4abe1e12411055c4039733aed41e70007a689 /hw/virtio/vhost-vsock.c | |
parent | b0a8f9adfed871728154b0064a28e34b6670f9f2 (diff) |
hw: replace qemu_set_nonblock()
Those calls are non-socket fd, or are POSIX-specific. Use the dedicated
GLib API. (qemu_set_nonblock() is for socket-like)
(this is a preliminary patch before renaming qemu_set_nonblock())
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-vsock.c')
-rw-r--r-- | hw/virtio/vhost-vsock.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 433d42d897..714046210b 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -149,9 +149,8 @@ static void vhost_vsock_device_realize(DeviceState *dev, Error **errp) return; } - ret = qemu_try_set_nonblock(vhostfd); - if (ret < 0) { - error_setg_errno(errp, -ret, + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, "vhost-vsock: unable to set non-blocking mode"); return; } @@ -163,7 +162,11 @@ static void vhost_vsock_device_realize(DeviceState *dev, Error **errp) return; } - qemu_set_nonblock(vhostfd); + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, + "Failed to set FD nonblocking"); + return; + } } vhost_vsock_common_realize(vdev, "vhost-vsock"); |