Message ID | 20211112051040.923746-3-leobras@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | MSG_ZEROCOPY + multifd | expand |
On Fri, Nov 12, 2021 at 02:10:37AM -0300, Leonardo Bras wrote: > Change qio_channel_socket_writev() in order to accept flags, so its possible > to selectively make use of sendmsg() flags. > > qio_channel_socket_writev() contents were moved to a helper function > qio_channel_socket_writev_flags() which accepts an extra argument for flags. > (This argument is passed directly to sendmsg(). > > Signed-off-by: Leonardo Bras <leobras@redhat.com> > --- > io/channel-socket.c | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel
Hello Daniel, Thanks for reviewing! Best regards, Leo On Fri, Nov 12, 2021 at 7:15 AM Daniel P. Berrangé <berrange@redhat.com> wrote: > > On Fri, Nov 12, 2021 at 02:10:37AM -0300, Leonardo Bras wrote: > > Change qio_channel_socket_writev() in order to accept flags, so its possible > > to selectively make use of sendmsg() flags. > > > > qio_channel_socket_writev() contents were moved to a helper function > > qio_channel_socket_writev_flags() which accepts an extra argument for flags. > > (This argument is passed directly to sendmsg(). > > > > Signed-off-by: Leonardo Bras <leobras@redhat.com> > > --- > > io/channel-socket.c | 26 +++++++++++++++++++------- > > 1 file changed, 19 insertions(+), 7 deletions(-) > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| >
diff --git a/io/channel-socket.c b/io/channel-socket.c index 606ec97cf7..b57a27bf91 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -520,12 +520,13 @@ static ssize_t qio_channel_socket_readv(QIOChannel *ioc, return ret; } -static ssize_t qio_channel_socket_writev(QIOChannel *ioc, - const struct iovec *iov, - size_t niov, - int *fds, - size_t nfds, - Error **errp) +static ssize_t qio_channel_socket_writev_flags(QIOChannel *ioc, + const struct iovec *iov, + size_t niov, + int *fds, + size_t nfds, + int flags, + Error **errp) { QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc); ssize_t ret; @@ -558,7 +559,7 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc, } retry: - ret = sendmsg(sioc->fd, &msg, 0); + ret = sendmsg(sioc->fd, &msg, flags); if (ret <= 0) { if (errno == EAGAIN) { return QIO_CHANNEL_ERR_BLOCK; @@ -572,6 +573,17 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc, } return ret; } + +static ssize_t qio_channel_socket_writev(QIOChannel *ioc, + const struct iovec *iov, + size_t niov, + int *fds, + size_t nfds, + Error **errp) +{ + return qio_channel_socket_writev_flags(ioc, iov, niov, fds, nfds, 0, errp); +} + #else /* WIN32 */ static ssize_t qio_channel_socket_readv(QIOChannel *ioc, const struct iovec *iov,
Change qio_channel_socket_writev() in order to accept flags, so its possible to selectively make use of sendmsg() flags. qio_channel_socket_writev() contents were moved to a helper function qio_channel_socket_writev_flags() which accepts an extra argument for flags. (This argument is passed directly to sendmsg(). Signed-off-by: Leonardo Bras <leobras@redhat.com> --- io/channel-socket.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)