From patchwork Wed May 26 14:09:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 53628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E51C1B7D1B for ; Thu, 27 May 2010 01:01:02 +1000 (EST) Received: from localhost ([127.0.0.1]:35951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHI6N-0002cA-Dy for incoming@patchwork.ozlabs.org; Wed, 26 May 2010 11:00:59 -0400 Received: from [140.186.70.92] (port=45440 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHHN9-0003Mk-To for qemu-devel@nongnu.org; Wed, 26 May 2010 10:14:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHHIt-00045j-7c for qemu-devel@nongnu.org; Wed, 26 May 2010 10:09:52 -0400 Received: from mail-ww0-f45.google.com ([74.125.82.45]:39026) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHHIt-00044Y-2v for qemu-devel@nongnu.org; Wed, 26 May 2010 10:09:51 -0400 Received: by mail-ww0-f45.google.com with SMTP id 39so860125wwb.4 for ; Wed, 26 May 2010 07:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=JtKJvYXnrYUgA8dQpNA8ocPsnrDEW++isUaR5s8jTNk=; b=j9JZUAimtEno3+4SKQWKjKwsg4PBIr5/dpwBe2DbVVvhUQ+JS/pYpnml2UqRHeD+Xq MiXcToY2cEPNcz1QEJikh0QsRd0cbY2vfJUTYfq//rTxVzRMixXhQzor1y9JQrUstIDz S9iZh342kk6oNGiqYnTCapGXkoA/vN5lNycgw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=M4a0Z+Dmk46N3W79xhW6oxHymlUlLg2YQ3lmtlLwa4YaAK2Z5id1gt1T3o3vnkVhba 28DkSAH7qOISE++hpgk4s+wDvC8Xkr3u+wvMB3DrzRLr9YetO4Whb3c0hXOym8QaxzCG gLPHGD3vEpIZlMmtB5Gc/kUD/yAYQVjsIyDY8= Received: by 10.227.154.204 with SMTP id p12mr8480084wbw.141.1274882990268; Wed, 26 May 2010 07:09:50 -0700 (PDT) Received: from localhost.localdomain (nat-pool-brq-t.redhat.com [209.132.186.34]) by mx.google.com with ESMTPS id u32sm318964wbc.11.2010.05.26.07.09.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 May 2010 07:09:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 26 May 2010 16:09:33 +0200 Message-Id: <1274882978-9875-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1274882978-9875-1-git-send-email-pbonzini@redhat.com> References: <1274882978-9875-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 3/8] remove event_notifier_test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is broken; since the eventfd is used in nonblocking mode there is a race between reading and writing. Signed-off-by: Paolo Bonzini --- event_notifier.c | 15 --------------- event_notifier.h | 1 - 2 files changed, 0 insertions(+), 16 deletions(-) diff --git a/event_notifier.c b/event_notifier.c index 3f50568..0f7b8da 100644 --- a/event_notifier.c +++ b/event_notifier.c @@ -51,18 +51,3 @@ int event_notifier_test_and_clear(EventNotifier *e) int r = read(e->fd, &value, sizeof(value)); return r == sizeof(value); } - -int event_notifier_test(EventNotifier *e) -{ - uint64_t value; - int r = read(e->fd, &value, sizeof(value)); - if (r == sizeof(value)) { - /* restore previous value. */ - int s = write(e->fd, &value, sizeof(value)); - /* never blocks because we use EFD_SEMAPHORE. - * If we didn't we'd get EAGAIN on overflow - * and we'd have to write code to ignore it. */ - assert(s == sizeof(value)); - } - return r == sizeof(value); -} diff --git a/event_notifier.h b/event_notifier.h index 8d5735f..714d690 100644 --- a/event_notifier.h +++ b/event_notifier.h @@ -12,6 +12,5 @@ void event_notifier_cleanup(EventNotifier *); int event_notifier_get_fd(EventNotifier *); int event_notifier_set(EventNotifier *); int event_notifier_test_and_clear(EventNotifier *); -int event_notifier_test(EventNotifier *); #endif