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-0003mb-Bc for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:20 -0500 Received: from [199.232.76.173] (port=57549 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcOUx-0003lc-Aw 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 1NcOUv-00086W-BR for qemu-devel@nongnu.org; Tue, 02 Feb 2010 14:33:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6104) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NcOUu-00086E-IF 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 o12JXFFA026250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Feb 2010 14:33:16 -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 o12JXCJH009573 for ; Tue, 2 Feb 2010 14:33:15 -0500 From: Paolo Bonzini Date: Tue, 2 Feb 2010 20:33:10 +0100 Message-Id: <1265139191-13568-3-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 2/3] loop write in qemu_event_increment upon EINTR List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Same as what qemu-kvm does. Signed-off-by: Paolo Bonzini --- vl.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 46c1118..f150eca 100644 --- a/vl.c +++ b/vl.c @@ -3198,8 +3198,12 @@ static void qemu_event_increment(void) if (io_thread_fd == -1) return; - ret = write(io_thread_fd, &byte, sizeof(byte)); - if (ret < 0 && (errno != EINTR && errno != EAGAIN)) { + do { + ret = write(io_thread_fd, &byte, sizeof(byte)); + } while (ret < 0 && errno == EINTR); + + /* EAGAIN is fine, a read must be pending. */ + if (ret < 0 && errno != EAGAIN) { fprintf(stderr, "qemu_event_increment: write() filed: %s\n", strerror(errno)); exit (1); -- 1.6.6