From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agt0J-0007f8-2Q for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:55:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agt0E-0004tY-3O for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:55:42 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:34631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agt0D-0004sU-Ke for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:55:38 -0400 Received: by mail-wm0-x229.google.com with SMTP id p65so65282957wmp.1 for ; Fri, 18 Mar 2016 04:55:37 -0700 (PDT) Sender: Paolo Bonzini References: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> From: Paolo Bonzini Message-ID: <56EBECB6.7020901@redhat.com> Date: Fri, 18 Mar 2016 12:55:34 +0100 MIME-Version: 1.0 In-Reply-To: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] char: translate from QIOChannel error to errno List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: danpb@redhat.com On 11/03/2016 18:55, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau > > 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 > --- > 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++) { > I can take this patch as it fixes a real regression, but could QIOChannel just return negative errno? Paolo