From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfHMU-0005W2-DY for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:30 -0500 Received: from [199.232.76.173] (port=49511 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfHMT-0005Vq-RF for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:29 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfHMS-0001B1-CO for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:29 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:46951) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfHMS-000178-0F for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:28 -0500 Received: by mail-iw0-f194.google.com with SMTP id 32so527339iwn.14 for ; Wed, 10 Feb 2010 10:32:27 -0800 (PST) Message-ID: <4B72FBB8.80800@codemonkey.ws> Date: Wed, 10 Feb 2010 12:32:24 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/3] do not loop on an incomplete io_thread_fd read References: <1265139191-13568-1-git-send-email-pbonzini@redhat.com> <1265139191-13568-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1265139191-13568-2-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/02/2010 01:33 PM, Paolo Bonzini wrote: > No need to loop if less than a full buffer is read, the next > read would return EAGAIN. > > Signed-off-by: Paolo Bonzini > Applied all. Thanks. Regards, Anthony Liguori > --- > vl.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/vl.c b/vl.c > index 6f1e1ab..46c1118 100644 > --- a/vl.c > +++ b/vl.c > @@ -3210,12 +3210,12 @@ static void qemu_event_read(void *opaque) > { > int fd = (unsigned long)opaque; > ssize_t len; > + char buffer[512]; > > /* Drain the notify pipe */ > do { > - char buffer[512]; > len = read(fd, buffer, sizeof(buffer)); > - } while ((len == -1&& errno == EINTR) || len> 0); > + } while ((len == -1&& errno == EINTR) || len == sizeof(buffer)); > } > > static int qemu_event_init(void) >