From patchwork Fri Mar 11 17:55:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 8568301 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B028B9F38C for ; Fri, 11 Mar 2016 17:55:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C6E52026F for ; Fri, 11 Mar 2016 17:55:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E20C2026D for ; Fri, 11 Mar 2016 17:55:51 +0000 (UTC) Received: from localhost ([::1]:56991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeRHy-0000og-SO for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 12:55:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeRHn-0000oC-99 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 12:55:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeRHj-0003OM-0Q for qemu-devel@nongnu.org; Fri, 11 Mar 2016 12:55:39 -0500 Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]:33762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeRHi-0003Nz-OD for qemu-devel@nongnu.org; Fri, 11 Mar 2016 12:55:34 -0500 Received: by mail-qk0-x234.google.com with SMTP id s5so50808091qkd.0 for ; Fri, 11 Mar 2016 09:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fvdcI57LgOTcAYtIUW7oxu7GZ1WEQXM5TsoBVW8iiTs=; b=ghVm7kbElDl5UVyzGO87YInedPubGvfCEKMhAWqEhredkJ6YdrLP3ir+bHt/cTp+yQ PHuLexYhX+PEM8/EBF2R2u+RCPzfWIagkXvvQ7nbUjIXhBm1b0bIhgqvbXcSTpoObkmJ b7mjastqUQntU7ioHN0sPVSLzAtmyfqznRNjIxdbjgzLAECOE3adBDY7zhwUMzbF9Mjo pI+PnwI0VnYNPd6As+ZK8dQs5SPTsog9BXvDrjL2WwuAcHtrPC8nDY6CBAwpt9uIJR3I UF+qtRv9h4RsOVOlnC4vgV2Sprt2DEQTP4oAn97xdWibrpnzcf/VeLx/+AbOYfYaGGX5 8+Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=fvdcI57LgOTcAYtIUW7oxu7GZ1WEQXM5TsoBVW8iiTs=; b=YryhOgP9QmT5owjNaFP7C3zpGcRdHFBBL4OVXjxBSSpBtkRuXO+DM8YPXIe2dMTc7X b3S3r0hamUhEUoJlbKcTC5Wd1Zxx3jS395YwnVMZgemDLvPiBBI1K9j5LQwwefWZSA19 bXbynSrJP13xwQXO/HzfL4YWt5nryelhm7NqbH34bWudyFNJ9mRD8crThZpjmOtxwLgK ZnrajNQR9ebpgBVvwPhbxkB7BBnBUOdKxh77Ytqf6VffHjeQe6N7F+LVfKVMJ53lv2u9 WgA3JVx1TSaT9WOk+MjxhgbAocBtxd8mQLYDHeHb2UxiqkMztnbjrhzNWQ+6WTiBtvRl lJ6Q== X-Gm-Message-State: AD7BkJLtTxbbYwj8J2OtzTkRuLOnI2gSoi7xo1/Af1o7u/duMCuF6k9qbxfpzQIEt0bKEw== X-Received: by 10.55.81.87 with SMTP id f84mr13449177qkb.10.1457718934020; Fri, 11 Mar 2016 09:55:34 -0800 (PST) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id x79sm4429097qka.37.2016.03.11.09.55.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Mar 2016 09:55:33 -0800 (PST) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 11 Mar 2016 18:55:24 +0100 Message-Id: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::234 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , danpb@redhat.com Subject: [Qemu-devel] [PATCH] char: translate from QIOChannel error to errno X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Daniel P. Berrange --- 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++) {