From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwEfg-0003ty-QP for qemu-devel@nongnu.org; Fri, 18 Jan 2013 11:20:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwEfc-0002Zl-A6 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 11:20:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwEbs-0001rs-8f for qemu-devel@nongnu.org; Fri, 18 Jan 2013 11:16:04 -0500 Message-ID: <50F97540.2010503@redhat.com> Date: Fri, 18 Jan 2013 17:16:00 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1358524722-24542-1-git-send-email-andreas.faerber@web.de> <50F972C9.6090308@redhat.com> <50F97334.6080802@web.de> In-Reply-To: <50F97334.6080802@web.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC for-1.4] qemu-thread-posix: Fix build for OpenBSD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: qemu-devel@nongnu.org Il 18/01/2013 17:07, Andreas F=C3=A4rber ha scritto: > Am 18.01.2013 17:05, schrieb Paolo Bonzini: >> Il 18/01/2013 16:58, Andreas F=C3=A4rber ha scritto: >>> Avoid an undefined reference to sem_timedwait. >>> >>> Signed-off-by: Andreas F=C3=A4rber >>> --- >>> include/qemu/thread-posix.h | 2 +- >>> util/qemu-thread-posix.c | 10 +++++----- >>> 2 Dateien ge=C3=A4ndert, 6 Zeilen hinzugef=C3=BCgt(+), 6 Zeilen entf= ernt(-) >>> >>> 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 { >>> }; >>> =20 >>> 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; >>> =20 >>> -#if defined(__APPLE__) || defined(__NetBSD__) >>> +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__= ) >>> rc =3D pthread_mutex_init(&sem->lock, NULL); >>> if (rc !=3D 0) { >>> error_exit(rc, __func__); >>> @@ -147,7 +147,7 @@ void qemu_sem_destroy(QemuSemaphore *sem) >>> { >>> int rc; >>> =20 >>> -#if defined(__APPLE__) || defined(__NetBSD__) >>> +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__= ) >>> rc =3D pthread_cond_destroy(&sem->cond); >>> if (rc < 0) { >>> error_exit(rc, __func__); >>> @@ -168,7 +168,7 @@ void qemu_sem_post(QemuSemaphore *sem) >>> { >>> int rc; >>> =20 >>> -#if defined(__APPLE__) || defined(__NetBSD__) >>> +#if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__= ) >>> pthread_mutex_lock(&sem->lock); >>> if (sem->count =3D=3D INT_MAX) { >>> rc =3D EINVAL; >>> @@ -206,7 +206,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms= ) >>> int rc; >>> struct timespec ts; >>> =20 >>> -#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= ) >>> =20 >>> 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) { >>> >> >> This was reverted recently. Apparently your OpenBSD is too old compar= ed >> to what Brad wants to support... >=20 > This is 5.1 from 2012. 2012 does sound a bit too recent, but then maybe not considering OpenBSD is only now getting a decent threading library. I suggest this approach: http://lwn.net/Articles/527216/ Paolo Paolo