From: "Daniel P. Berrange" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] char: translate from QIOChannel error to errno
Date: Fri, 11 Mar 2016 18:36:00 +0000 [thread overview]
Message-ID: <20160311183600.GG30098@redhat.com> (raw)
In-Reply-To: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com>
On Fri, Mar 11, 2016 at 06:55:24PM +0100, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Caller of CharDriverState.chr* callback assume errno error conventions.
> Translate QIOChannel error to errno (this fixes potential EAGAIN
> regression, for ex if a vhost-user backend block, qemu_chr_fe_read_all()
> could get error -2 and not wait)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> qemu-char.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index ad11b75..4317388 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2727,6 +2727,13 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
> NULL);
> }
>
> + if (ret == QIO_CHANNEL_ERR_BLOCK) {
> + errno = EAGAIN;
> + ret = -1;
> + } else if (ret == -1) {
> + errno = EIO;
> + }
> +
> if (msgfds_num) {
> /* close and clean read_msgfds */
> for (i = 0; i < s->read_msgfds_num; i++) {
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2016-03-11 18:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 17:55 [Qemu-devel] [PATCH] char: translate from QIOChannel error to errno marcandre.lureau
2016-03-11 18:36 ` Daniel P. Berrange [this message]
2016-03-18 11:55 ` Paolo Bonzini
2016-03-18 12:03 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160311183600.GG30098@redhat.com \
--to=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).