From patchwork Fri Dec 28 06:38:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Smith X-Patchwork-Id: 208416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 94BBA2C00D2 for ; Fri, 28 Dec 2012 17:38:43 +1100 (EST) Received: from localhost ([::1]:51188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToTaa-00041l-RH for incoming@patchwork.ozlabs.org; Fri, 28 Dec 2012 01:38:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToTaS-00041V-1B for qemu-devel@nongnu.org; Fri, 28 Dec 2012 01:38:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToTaQ-0003Mh-KP for qemu-devel@nongnu.org; Fri, 28 Dec 2012 01:38:31 -0500 Received: from speedy.comstyle.com ([2001:470:1d:8c::2]:19028 helo=mail.comstyle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToTaQ-0003Md-GQ for qemu-devel@nongnu.org; Fri, 28 Dec 2012 01:38:30 -0500 Received: from rox.home.comstyle.com (unknown [IPv6:2001:470:b01e:3:74db:fa43:e58b:905c]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 4B66129BA1 for ; Fri, 28 Dec 2012 01:38:14 -0500 (EST) Date: Fri, 28 Dec 2012 01:38:11 -0500 From: Brad Smith To: qemu-devel@nongnu.org Message-ID: <20121228063808.GC27232@rox.home.comstyle.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-comstyle-MailScanner-Information: Please contact the ISP for more information X-comstyle-MailScanner-ID: 4B66129BA1.A6DEB X-comstyle-MailScanner: Found to be clean X-comstyle-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-2.9, required 6, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-comstyle-MailScanner-From: brad@comstyle.com X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:470:1d:8c::2 Subject: [Qemu-devel] [PATCH] Disable semaphores fallback code for OpenBSD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Disable the semaphores fallback code for OpenBSD as modern OpenBSD releases now have sem_timedwait(). Signed-off-by: Brad Smith diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index 380bae2..0f30dcc 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -12,7 +12,7 @@ struct QemuCond { }; struct QemuSemaphore { -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_t lock; pthread_cond_t cond; int count; diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index 7be292e..6374df3 100644 --- a/qemu-thread-posix.c +++ b/qemu-thread-posix.c @@ -122,7 +122,7 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) rc = pthread_mutex_init(&sem->lock, NULL); if (rc != 0) { error_exit(rc, __func__); @@ -147,7 +147,7 @@ void qemu_sem_destroy(QemuSemaphore *sem) { int rc; -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) rc = pthread_cond_destroy(&sem->cond); if (rc < 0) { error_exit(rc, __func__); @@ -168,7 +168,7 @@ void qemu_sem_post(QemuSemaphore *sem) { int rc; -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); if (sem->count == INT_MAX) { rc = EINVAL; @@ -206,7 +206,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) int rc; struct timespec ts; -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) compute_abs_deadline(&ts, ms); pthread_mutex_lock(&sem->lock); --sem->count; @@ -248,7 +248,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) void qemu_sem_wait(QemuSemaphore *sem) { -#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); --sem->count; while (sem->count < 0) {