]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
io: add a "blocking" field to QIOChannelSocket
authorTejus GK <tejus.gk@nutanix.com>
Fri, 24 Oct 2025 13:15:42 +0000 (13:15 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 3 Nov 2025 10:05:40 +0000 (10:05 +0000)
Add a 'blocking' boolean field to QIOChannelSocket to track whether the
underlying socket is in blocking or non-blocking mode.

Signed-off-by: Tejus GK <tejus.gk@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
include/io/channel-socket.h
io/channel-socket.c

index a88cf8b3a9f9cc2eaa65168f6e1100a171ff0003..26319fa98bb20bdb8a5adbc4e65c08cbbf25ab75 100644 (file)
@@ -49,6 +49,7 @@ struct QIOChannelSocket {
     socklen_t remoteAddrLen;
     ssize_t zero_copy_queued;
     ssize_t zero_copy_sent;
+    bool blocking;
 };
 
 
index 712b793eaf2cd1caf53c6aa2ab6176cfd57d6bc3..8b30d5b7f72e15ead86e844cafe6089a17132473 100644 (file)
@@ -65,6 +65,7 @@ qio_channel_socket_new(void)
     sioc->fd = -1;
     sioc->zero_copy_queued = 0;
     sioc->zero_copy_sent = 0;
+    sioc->blocking = false;
 
     ioc = QIO_CHANNEL(sioc);
     qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_SHUTDOWN);
@@ -859,6 +860,7 @@ qio_channel_socket_set_blocking(QIOChannel *ioc,
                                 Error **errp)
 {
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
+    sioc->blocking = enabled;
 
     if (!qemu_set_blocking(sioc->fd, enabled, errp)) {
         return -1;