From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcOUy-0003mU-Cg for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:20 -0500 Received: from [199.232.76.173] (port=57550 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcOUx-0003lj-EA for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:19 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcOUu-00086R-VB for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3974) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NcOUu-000866-F2 for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:16 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o12JXEKv017385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Feb 2010 14:33:15 -0500 Received: from localhost.localdomain (vpn1-5-208.ams2.redhat.com [10.36.5.208]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o12JXCJG009573 for ; Tue, 2 Feb 2010 14:33:14 -0500 From: Paolo Bonzini Date: Tue, 2 Feb 2010 20:33:09 +0100 Message-Id: <1265139191-13568-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1265139191-13568-1-git-send-email-pbonzini@redhat.com> References: <1265139191-13568-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] do not loop on an incomplete io_thread_fd read List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org No need to loop if less than a full buffer is read, the next read would return EAGAIN. Signed-off-by: Paolo Bonzini --- 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) -- 1.6.6