From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Andreas Färber" <andreas.faerber@web.de>
Subject: [Qemu-devel] [PATCH RFC for-1.4] qemu-thread-posix: Fix build for OpenBSD
Date: Fri, 18 Jan 2013 16:58:42 +0100 [thread overview]
Message-ID: <1358524722-24542-1-git-send-email-andreas.faerber@web.de> (raw)
Avoid an undefined reference to sem_timedwait.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
include/qemu/thread-posix.h | 2 +-
util/qemu-thread-posix.c | 10 +++++-----
2 Dateien geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
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) {
--
1.7.10.4
next reply other threads:[~2013-01-18 15:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 15:58 Andreas Färber [this message]
2013-01-18 16:05 ` [Qemu-devel] [PATCH RFC for-1.4] qemu-thread-posix: Fix build for OpenBSD Paolo Bonzini
2013-01-18 16:07 ` Andreas Färber
2013-01-18 16:16 ` Paolo Bonzini
2013-01-19 9:44 ` Blue Swirl
2013-01-19 18:07 ` Andreas Färber
2013-01-19 10:13 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358524722-24542-1-git-send-email-andreas.faerber@web.de \
--to=andreas.faerber@web.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).