From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeRuz-0006Ni-F0 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 13:36:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeRuv-0008N5-Jh for qemu-devel@nongnu.org; Fri, 11 Mar 2016 13:36:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeRuv-0008Mt-E6 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 13:36:05 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 935A964D04 for ; Fri, 11 Mar 2016 18:36:04 +0000 (UTC) Date: Fri, 11 Mar 2016 18:36:00 +0000 From: "Daniel P. Berrange" Message-ID: <20160311183600.GG30098@redhat.com> References: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] char: translate from QIOChannel error to errno Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org On Fri, Mar 11, 2016 at 06:55:24PM +0100, marcandre.lureau@redhat.com wro= te: > From: Marc-Andr=C3=A9 Lureau >=20 > 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) >=20 > Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrange > --- > qemu-char.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > 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); > } > =20 > + if (ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { > + errno =3D EAGAIN; > + ret =3D -1; > + } else if (ret =3D=3D -1) { > + errno =3D EIO; > + } > + > if (msgfds_num) { > /* close and clean read_msgfds */ > for (i =3D 0; i < s->read_msgfds_num; i++) { Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|