From patchwork Tue Jun 28 17:22:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 641638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rfCMK39LVz9t0q for ; Wed, 29 Jun 2016 03:23:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=kj/I2uy2; dkim-atps=neutral Received: from localhost ([::1]:38383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwjb-0001Qh-Ai for incoming@patchwork.ozlabs.org; Tue, 28 Jun 2016 13:23:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwiz-0000mU-AG for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:23:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHwiw-00082U-3y for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:23:01 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwiv-00082I-Tb for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:22:58 -0400 Received: by mail-wm0-x242.google.com with SMTP id 187so7603778wmz.1 for ; Tue, 28 Jun 2016 10:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=OhT+OlA3E8tOiBpgLMfQ8Pp9/D/56/PNWJDnK9KaNGc=; b=kj/I2uy2DxFRuvqlV6OwAIA5b4ZYiOGPAssVBVp4H0df7dig9B6wMgai1x/YESym6G R++Lmqj6U1r/KPtZSAfxQ27VQt1I6M6BTaoFl7aKvN021VP0GdAkOVWfX2O4k7YHy3WY hQc3dRAvVt3XqcMTY3zM7KKl+gbZQweedBLRuQdyee9FOxcjFUi1jHzHPcDPqBX6ZdCP ROIy6BxzZv6bOrbMfB7q6fAPuwYcolzmIvBbnnqMdhu1AjbyQgQJO8uorm777b6jDtVA iyC/7S3Avj/3GRBTithw0IscESpUdmAsiQ4Pvdhq5GaHgJXUVIao9prfmYEDz8XL+g41 HX0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=OhT+OlA3E8tOiBpgLMfQ8Pp9/D/56/PNWJDnK9KaNGc=; b=A2qMXDYSruxnktUABEva4IVGHVqQB6KjVe27Wa9uqoAxXp4z4+a9gyvmYOMGxADRPO 8AxR1kstZm9zkil0Od9wAOxYWkNg29BzblTQfBeK0rAOQJ1nRCmVuBvk12Ai+toi2igj XN9SzbLurJ3B+zz+Pbz2OwSRT3mbjh1My+3RAcIWrcbCu2FHrftYEfCpUXKy7MhrkLBX /psD4erT2OnAFEHeWTrtzic6L3q2OICq9dwBtcw0rHuOAkg5WRSdN8TnCc1LhW+9JKrI mvDRX8bPFQ4102hUOlTOB67yfchVoJPDoBA4jdmIFJOvlHQlfQFzhcPVpWxvAXHkfjuD q2kA== X-Gm-Message-State: ALyK8tInd8xz1QlfzaPzgo8A8g9mASvh4u9woqAI6GjPTCs1jCs5+Wrd5LSCbrE+yU69/w== X-Received: by 10.194.179.131 with SMTP id dg3mr4532687wjc.143.1467134577030; Tue, 28 Jun 2016 10:22:57 -0700 (PDT) Received: from donizetti.lan (94-39-188-118.adsl-ull.clienti.tiscali.it. [94.39.188.118]) by smtp.gmail.com with ESMTPSA id r190sm12111137wme.17.2016.06.28.10.22.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 10:22:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 28 Jun 2016 19:22:49 +0200 Message-Id: <1467134569-32294-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This fixes compilation with glib versions up to 2.30, such as the one in CentOS 6. Even with this patch the test fails though: ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:165:wait_for_fds: assertion failed: (s->fds_num) Signed-off-by: Paolo Bonzini Reviewed-by: Marc-André Lureau --- tests/vhost-user-test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 8b2164b..4de64df 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -127,21 +127,24 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; - GMutex data_mutex; - GCond data_cond; + CompatGMutex data_mutex; + CompatGCond data_cond; int log_fd; uint64_t rings; } TestServer; #if !GLIB_CHECK_VERSION(2, 32, 0) -static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex, +static gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex, gint64 end_time) { gboolean ret = FALSE; end_time -= g_get_monotonic_time(); GTimeVal time = { end_time / G_TIME_SPAN_SECOND, end_time % G_TIME_SPAN_SECOND }; - ret = g_cond_timed_wait(cond, mutex, &time); + g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS); + g_once(&cond->once, do_g_cond_new, NULL); + ret = g_cond_timed_wait((GCond *) cond->once.retval, + (GMutex *) mutex->once.retval, &time); return ret; } #endif