[PATCH v2 0/8] io: deal with blocking/non-blocking fds

Vladimir Sementsov-Ogievskiy posted 8 patches 2 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250911092007.1370002-1-vsementsov@yandex-team.ru
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Gustavo Romero <gustavo.romero@linaro.org>, Stefano Garzarella <sgarzare@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Jason Wang <jasowang@redhat.com>, Michael Roth <michael.roth@amd.com>, Kostiantyn Kostiuk <kkostiuk@redhat.com>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fabiano Rosas <farosas@suse.de>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Laurent Vivier <lvivier@redhat.com>, Stefan Weil <sw@weilnetz.de>, Coiby Xu <Coiby.Xu@gmail.com>
There is a newer version of this series
chardev/char-fd.c                       |  4 +-
chardev/char-pty.c                      |  3 +-
chardev/char-serial.c                   |  3 +-
chardev/char-socket.c                   | 21 ++-----
chardev/char-stdio.c                    |  3 +-
contrib/ivshmem-server/ivshmem-server.c |  6 +-
hw/hyperv/syndbg.c                      |  4 +-
hw/input/virtio-input-host.c            |  3 +-
hw/misc/ivshmem-flat.c                  |  3 +-
hw/misc/ivshmem-pci.c                   |  7 ++-
hw/virtio/vhost-user.c                  |  5 +-
hw/virtio/vhost-vsock.c                 |  8 +--
include/qemu/osdep.h                    |  1 +
include/qemu/sockets.h                  |  3 -
io/channel-command.c                    |  9 ++-
io/channel-file.c                       |  3 +-
io/channel-socket.c                     | 80 ++++++++++++++++++-------
net/dgram.c                             | 28 +++++----
net/l2tpv3.c                            |  5 +-
net/socket.c                            | 27 ++++++---
net/stream.c                            |  9 +--
net/stream_data.c                       | 10 ++--
net/tap-bsd.c                           | 12 +++-
net/tap-linux.c                         |  7 ++-
net/tap-solaris.c                       |  7 ++-
net/tap.c                               | 21 ++-----
qga/channel-posix.c                     |  7 ++-
qga/commands-posix.c                    |  3 +-
tests/qtest/fuzz/virtio_net_fuzz.c      |  2 +-
tests/qtest/vhost-user-test.c           |  3 +-
tests/unit/socket-helpers.c             |  5 +-
tests/unit/test-crypto-tlssession.c     |  8 +--
tests/unit/test-iov.c                   |  5 +-
ui/input-linux.c                        |  3 +-
util/event_notifier-posix.c             |  4 +-
util/main-loop.c                        |  5 +-
util/oslib-posix.c                      | 22 ++++---
util/oslib-win32.c                      | 25 ++++----
util/vhost-user-server.c                |  4 +-
39 files changed, 224 insertions(+), 164 deletions(-)
[PATCH v2 0/8] io: deal with blocking/non-blocking fds
Posted by Vladimir Sementsov-Ogievskiy 2 weeks, 3 days ago
Hi all!

The series aims to unify code which sets fds blocking/non-blocking
through the whole source.

01: reworked, only drop the for-loop
02: new
03: - improve commit-message, add a lot of motivation REREAD
    - convert GError to Error in a new function
04: - add notes about caller conversion in commit message REREAD
    - add r-b by Peter
    - save IVSHMEM_SERVER_DEBUG()
    - finally decided to keep g_warning() for now: conversion
      g_warning() -> g_printerr() should better be another series
      and cover the whole code-base (actually not too much, and
      mostly in qga)
05: add r-b by Peter
06: new
07: functional part moved to separate commit
08: - fix commit message
    - drop redundant qemu/sockets.h includes

v2 is also based on
[PATCH v4 0/2] save qemu-file incoming non-blocking fds
Based-on: <20250910193112.1220763-1-vsementsov@yandex-team.ru>

Vladimir Sementsov-Ogievskiy (8):
  char-socket: tcp_chr_recv(): drop extra _set_(block,cloexec)
  char-socket: tcp_chr_recv(): add comment
  util: add qemu_set_blocking() function
  util: drop qemu_socket_set_nonblock()
  util: drop qemu_socket_try_set_nonblock()
  io/channel-socket: rework qio_channel_socket_copy_fds()
  util: drop qemu_socket_set_block()
  use qemu_set_blocking instead of g_unix_set_fd_nonblocking

 chardev/char-fd.c                       |  4 +-
 chardev/char-pty.c                      |  3 +-
 chardev/char-serial.c                   |  3 +-
 chardev/char-socket.c                   | 21 ++-----
 chardev/char-stdio.c                    |  3 +-
 contrib/ivshmem-server/ivshmem-server.c |  6 +-
 hw/hyperv/syndbg.c                      |  4 +-
 hw/input/virtio-input-host.c            |  3 +-
 hw/misc/ivshmem-flat.c                  |  3 +-
 hw/misc/ivshmem-pci.c                   |  7 ++-
 hw/virtio/vhost-user.c                  |  5 +-
 hw/virtio/vhost-vsock.c                 |  8 +--
 include/qemu/osdep.h                    |  1 +
 include/qemu/sockets.h                  |  3 -
 io/channel-command.c                    |  9 ++-
 io/channel-file.c                       |  3 +-
 io/channel-socket.c                     | 80 ++++++++++++++++++-------
 net/dgram.c                             | 28 +++++----
 net/l2tpv3.c                            |  5 +-
 net/socket.c                            | 27 ++++++---
 net/stream.c                            |  9 +--
 net/stream_data.c                       | 10 ++--
 net/tap-bsd.c                           | 12 +++-
 net/tap-linux.c                         |  7 ++-
 net/tap-solaris.c                       |  7 ++-
 net/tap.c                               | 21 ++-----
 qga/channel-posix.c                     |  7 ++-
 qga/commands-posix.c                    |  3 +-
 tests/qtest/fuzz/virtio_net_fuzz.c      |  2 +-
 tests/qtest/vhost-user-test.c           |  3 +-
 tests/unit/socket-helpers.c             |  5 +-
 tests/unit/test-crypto-tlssession.c     |  8 +--
 tests/unit/test-iov.c                   |  5 +-
 ui/input-linux.c                        |  3 +-
 util/event_notifier-posix.c             |  4 +-
 util/main-loop.c                        |  5 +-
 util/oslib-posix.c                      | 22 ++++---
 util/oslib-win32.c                      | 25 ++++----
 util/vhost-user-server.c                |  4 +-
 39 files changed, 224 insertions(+), 164 deletions(-)

-- 
2.48.1
Re: [PATCH v2 0/8] io: deal with blocking/non-blocking fds
Posted by Vladimir Sementsov-Ogievskiy 2 weeks, 3 days ago
On 11.09.25 12:19, Vladimir Sementsov-Ogievskiy wrote:
> Hi all!
> 
> The series aims to unify code which sets fds blocking/non-blocking
> through the whole source.
> 
> 01: reworked, only drop the for-loop
> 02: new
> 03: - improve commit-message, add a lot of motivation REREAD
>      - convert GError to Error in a new function
> 04: - add notes about caller conversion in commit message REREAD

REREAD - was notes for myself :)

>      - add r-b by Peter
>      - save IVSHMEM_SERVER_DEBUG()
>      - finally decided to keep g_warning() for now: conversion
>        g_warning() -> g_printerr() should better be another series
>        and cover the whole code-base (actually not too much, and
>        mostly in qga)
> 05: add r-b by Peter
> 06: new
> 07: functional part moved to separate commit
> 08: - fix commit message
>      - drop redundant qemu/sockets.h includes
> 
> v2 is also based on
> [PATCH v4 0/2] save qemu-file incoming non-blocking fds
> Based-on: <20250910193112.1220763-1-vsementsov@yandex-team.ru>
> 
> Vladimir Sementsov-Ogievskiy (8):
>    char-socket: tcp_chr_recv(): drop extra _set_(block,cloexec)
>    char-socket: tcp_chr_recv(): add comment
>    util: add qemu_set_blocking() function
>    util: drop qemu_socket_set_nonblock()
>    util: drop qemu_socket_try_set_nonblock()
>    io/channel-socket: rework qio_channel_socket_copy_fds()
>    util: drop qemu_socket_set_block()
>    use qemu_set_blocking instead of g_unix_set_fd_nonblocking
> 
>   chardev/char-fd.c                       |  4 +-
>   chardev/char-pty.c                      |  3 +-
>   chardev/char-serial.c                   |  3 +-
>   chardev/char-socket.c                   | 21 ++-----
>   chardev/char-stdio.c                    |  3 +-
>   contrib/ivshmem-server/ivshmem-server.c |  6 +-
>   hw/hyperv/syndbg.c                      |  4 +-
>   hw/input/virtio-input-host.c            |  3 +-
>   hw/misc/ivshmem-flat.c                  |  3 +-
>   hw/misc/ivshmem-pci.c                   |  7 ++-
>   hw/virtio/vhost-user.c                  |  5 +-
>   hw/virtio/vhost-vsock.c                 |  8 +--
>   include/qemu/osdep.h                    |  1 +
>   include/qemu/sockets.h                  |  3 -
>   io/channel-command.c                    |  9 ++-
>   io/channel-file.c                       |  3 +-
>   io/channel-socket.c                     | 80 ++++++++++++++++++-------
>   net/dgram.c                             | 28 +++++----
>   net/l2tpv3.c                            |  5 +-
>   net/socket.c                            | 27 ++++++---
>   net/stream.c                            |  9 +--
>   net/stream_data.c                       | 10 ++--
>   net/tap-bsd.c                           | 12 +++-
>   net/tap-linux.c                         |  7 ++-
>   net/tap-solaris.c                       |  7 ++-
>   net/tap.c                               | 21 ++-----
>   qga/channel-posix.c                     |  7 ++-
>   qga/commands-posix.c                    |  3 +-
>   tests/qtest/fuzz/virtio_net_fuzz.c      |  2 +-
>   tests/qtest/vhost-user-test.c           |  3 +-
>   tests/unit/socket-helpers.c             |  5 +-
>   tests/unit/test-crypto-tlssession.c     |  8 +--
>   tests/unit/test-iov.c                   |  5 +-
>   ui/input-linux.c                        |  3 +-
>   util/event_notifier-posix.c             |  4 +-
>   util/main-loop.c                        |  5 +-
>   util/oslib-posix.c                      | 22 ++++---
>   util/oslib-win32.c                      | 25 ++++----
>   util/vhost-user-server.c                |  4 +-
>   39 files changed, 224 insertions(+), 164 deletions(-)
> 


-- 
Best regards,
Vladimir