summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoop Mast <kwm@rainbow-runner.nl>2014-02-23 00:56:59 +0100
committerTanu Kaskinen <tanuk@iki.fi>2014-02-25 14:28:36 +0200
commitb115e9c592d31be4e123017e3ee08b7125a28558 (patch)
tree908965b755a20238455a508c19bca5db9e38bc07
parentd94cd5f73023f5c88237e7588b0a6698052f3482 (diff)
Make tests compile on FreeBSD
cpu_set_t is named cpuset_t on FreeBSD. Add headers to allow for warning free compilation.
-rw-r--r--src/tests/once-test.c11
-rw-r--r--src/tests/rtstutter.c11
2 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
index b39a0e33f..8b0009a00 100644
--- a/src/tests/once-test.c
+++ b/src/tests/once-test.c
@@ -23,6 +23,13 @@
#ifdef HAVE_PTHREAD
#include <pthread.h>
+#ifdef HAVE_PTHREAD_SETAFFINITY_NP
+#if defined(__FreeBSD__)
+#include <pthread_np.h>
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#endif
+#endif
#endif
#include <check.h>
@@ -56,7 +63,11 @@ static void thread_func(void *data) {
#ifdef HAVE_PTHREAD_SETAFFINITY_NP
static pa_atomic_t i_cpu = PA_ATOMIC_INIT(0);
+#ifdef __FreeBSD__
+ cpuset_t mask;
+#else
cpu_set_t mask;
+#endif
CPU_ZERO(&mask);
CPU_SET((size_t) (pa_atomic_inc(&i_cpu) % n_cpu), &mask);
diff --git a/src/tests/rtstutter.c b/src/tests/rtstutter.c
index 739683d56..ed567c130 100644
--- a/src/tests/rtstutter.c
+++ b/src/tests/rtstutter.c
@@ -30,6 +30,13 @@
#ifdef HAVE_PTHREAD
#include <pthread.h>
+#ifdef HAVE_PTHREAD_SETAFFINITY_NP
+#if defined(__FreeBSD__)
+#include <pthread_np.h>
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#endif
+#endif
#endif
#include <pulse/util.h>
@@ -54,7 +61,11 @@ static void work(void *p) {
#ifdef HAVE_PTHREAD_SETAFFINITY_NP
{
+#ifdef __FreeBSD__
+ cpuset_t mask;
+#else
cpu_set_t mask;
+#endif
CPU_ZERO(&mask);
CPU_SET((size_t) PA_PTR_TO_UINT(p), &mask);