From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UM6Ed-0001Ir-Ih for qemu-devel@nongnu.org; Sat, 30 Mar 2013 20:35:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UM6EZ-0002fZ-0V for qemu-devel@nongnu.org; Sat, 30 Mar 2013 20:34:59 -0400 Received: from [203.217.0.115] (port=11924 helo=bom.nom.co) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UM6EY-0002Yt-9N for qemu-devel@nongnu.org; Sat, 30 Mar 2013 20:34:54 -0400 Received: from bom.nom.co (mwb@localhost [127.0.0.1]) by bom.nom.co (8.14.5/8.14.3) with ESMTP id r2V0WUR7003185 for ; Sun, 31 Mar 2013 08:32:31 +0800 (WST) Received: (from mwb@localhost) by bom.nom.co (8.14.5/8.14.3/Submit) id r2V0WTw5009467 for qemu-devel@nongnu.org; Sun, 31 Mar 2013 08:32:29 +0800 (WST) Date: Sun, 31 Mar 2013 08:32:29 +0800 From: "Michael W. Bombardieri" Message-ID: <20130331003229.GA9097@bom.nom.co> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH]: Fix conditional compilation for OpenBSD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, This morning I tried building Qemu 1.4.0 on my Lenovo ThinkPad T61 running OpenBSD/i386 5.1. The thread code didn't build due to a missing library function. Looking at the code, #if statements for NetBSD should also be followed for OpenBSD. Using the following patch I was able to build Qemu using clang 3.0 (gcc 4.2.1 ran out of memory). Please consider committing this patch. - Michael diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index 0f30dcc..772d925 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -12,7 +12,7 @@ struct QemuCond { }; struct QemuSemaphore { -#if defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) pthread_mutex_t lock; pthread_cond_t cond; int count; diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 4489abf..fa8a3d8 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -122,7 +122,7 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; -#if defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) 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(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) 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(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) 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(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) compute_abs_deadline(&ts, ms); pthread_mutex_lock(&sem->lock); --sem->count; @@ -249,7 +249,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) void qemu_sem_wait(QemuSemaphore *sem) { -#if defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) pthread_mutex_lock(&sem->lock); --sem->count; while (sem->count < 0) {