Now we can use qemu_set_blocking() and stop ignore errors in
these case.
Just crash on error for now, as we'll rework it in following commits.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
include/qemu/sockets.h | 1 -
io/channel-socket.c | 3 ++-
util/oslib-posix.c | 6 ------
util/oslib-win32.c | 7 -------
4 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 9512fec514..be351d85f7 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -46,7 +46,6 @@ ssize_t qemu_send_full(int s, const void *buf, size_t count)
G_GNUC_WARN_UNUSED_RESULT;
int socket_set_cork(int fd, int v);
int socket_set_nodelay(int fd);
-void qemu_socket_set_block(int fd);
int socket_set_fast_reuse(int fd);
#ifdef WIN32
diff --git a/io/channel-socket.c b/io/channel-socket.c
index e77602a22e..4f7e86f72f 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -498,7 +498,8 @@ static void qio_channel_socket_copy_fds(struct msghdr *msg,
}
/* O_NONBLOCK is preserved across SCM_RIGHTS so reset it */
- qemu_socket_set_block(fd);
+ /* TODO: don't crash on error, just handle it! */
+ qemu_set_blocking(fd, true, &error_abort);
#ifndef MSG_CMSG_CLOEXEC
qemu_set_cloexec(fd);
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 51f16d57ff..8891d82db0 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -262,12 +262,6 @@ bool qemu_set_blocking(int fd, bool block, Error **errp)
return true;
}
-void qemu_socket_set_block(int fd)
-{
- g_unix_set_fd_nonblocking(fd, false, NULL);
-}
-
-
int socket_set_fast_reuse(int fd)
{
int val = 1, ret;
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index bf5d478c5c..b9ce2f96ee 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -195,13 +195,6 @@ bool qemu_set_blocking(int fd, bool block, Error **errp)
return true;
}
-void qemu_socket_set_block(int fd)
-{
- unsigned long opt = 0;
- qemu_socket_unselect(fd, NULL);
- ioctlsocket(fd, FIONBIO, &opt);
-}
-
int socket_set_fast_reuse(int fd)
{
/* Enabling the reuse of an endpoint that was used by a socket still in
--
2.48.1