Received: from eggs.gnu.org ([2001:4830:134:3::10]:44889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWSe-0003GE-Ik for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWSb-0007vx-Fy for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:44:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37268 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWSb-0007vJ-AS for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:44:13 -0400 References: <1528185295-14199-1-git-send-email-slp@redhat.com> <4e35ea24-147d-1b51-fa1b-0f1cc32966e0@redhat.com> <01f5d4ef-cea1-ff81-82cc-30a617a3c648@redhat.com> From: Paolo Bonzini Message-ID: <005419af-3739-af1b-6cde-fbbebec4bc81@redhat.com> Date: Mon, 9 Jul 2018 15:44:09 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write returns 0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Sergio Lopez , "Michael S. Tsirkin" , QEMU On 09/07/2018 15:21, Peter Maydell wrote: >> >> However, indeed it seems to me that the logic of the patch is backward= s: >> >> - -1/EAGAIN should retry >> >> - 0 should *not* retry, because it means the other side has hung up > This seems weird, because it doesn't follow the usual pattern > for non-blocking functions, where 0 just means "nothing was > written" and actual error conditions like the other side having > gone away are reported via -1 and some errno. >=20 Ah no, that's read(2). write(2) is as you say, so the patch should check for EAGAIN. Paolo