diff options
| author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2025-09-10 22:31:12 +0300 |
|---|---|---|
| committer | Daniel P. Berrangé <berrange@redhat.com> | 2025-09-19 12:46:06 +0100 |
| commit | d343f395e371aa1b859eb42be331918931a6637e (patch) | |
| tree | 529da4478a467c675f1d9da614a5cc7076be491b | |
| parent | 7bc2cbe3306899559c4da1b05e410235d994e22d (diff) | |
| download | focaccia-qemu-d343f395e371aa1b859eb42be331918931a6637e.tar.gz focaccia-qemu-d343f395e371aa1b859eb42be331918931a6637e.zip | |
io/channel: document how qio_channel_readv_full() handles fds
The only realization, which may have incoming fds is qio_channel_socket_readv() (in io/channel-socket.c). qio_channel_socket_readv() do call (through qio_channel_socket_copy_fds()) qemu_socket_set_block() and qemu_set_cloexec() for each fd. Also, qio_channel_socket_copy_fds() is called at the end of qio_channel_socket_readv(), on success path. Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to '')
| -rw-r--r-- | include/io/channel.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/io/channel.h b/include/io/channel.h index 12266256a8..c7f64506f7 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -118,6 +118,15 @@ struct QIOChannelClass { size_t nfds, int flags, Error **errp); + + /* + * The io_readv handler must guarantee that all + * incoming fds are set BLOCKING (unless + * QIO_CHANNEL_READ_FLAG_FD_PRESERVE_BLOCKING flag is set) and + * CLOEXEC (if available). + * @fds and @nfds are set only on success path, and untouched + * in case of errors. + */ ssize_t (*io_readv)(QIOChannel *ioc, const struct iovec *iov, size_t niov, @@ -125,6 +134,7 @@ struct QIOChannelClass { size_t *nfds, int flags, Error **errp); + int (*io_close)(QIOChannel *ioc, Error **errp); GSource * (*io_create_watch)(QIOChannel *ioc, @@ -235,6 +245,13 @@ void qio_channel_set_name(QIOChannel *ioc, * was allocated. It is the callers responsibility * to call close() on each file descriptor and to * call g_free() on the array pointer in @fds. + * @fds allocated and set (and @nfds is set too) + * _only_ on success path. These parameters are + * untouched in case of errors. + * qio_channel_readv_full() guarantees that all + * incoming fds are set BLOCKING (unless + * QIO_CHANNEL_READ_FLAG_FD_PRESERVE_BLOCKING flag + * is set) and CLOEXEC (if available). * * It is an error to pass a non-NULL @fds parameter * unless qio_channel_has_feature() returns a true |