summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/CMakeLists.txt2
-rw-r--r--src/lib/CMakeLists.txt3
-rw-r--r--src/lib/shm_flow_set.c6
-rw-r--r--src/lib/shm_rbuff_ll.c10
-rw-r--r--src/lib/shm_rbuff_pthr.c20
-rw-r--r--src/lib/shm_rdrbuff.c14
-rw-r--r--src/lib/tests/time_utils_test.c4
7 files changed, 29 insertions, 30 deletions
diff --git a/src/ipcpd/CMakeLists.txt b/src/ipcpd/CMakeLists.txt
index 00baa762..e0b375b6 100644
--- a/src/ipcpd/CMakeLists.txt
+++ b/src/ipcpd/CMakeLists.txt
@@ -8,7 +8,7 @@ set(IPCP_SOURCES
add_subdirectory(local)
add_subdirectory(normal)
add_subdirectory(shim-udp)
-if (NOT APPLE)
+if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL GNU)
add_subdirectory(shim-eth-llc)
endif ()
add_subdirectory(tests)
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 75eac6f9..fe4dd88c 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -77,9 +77,8 @@ else()
if (${LINUX_RND_HDR} STREQUAL "LINUX_RND_HDR-NOTFOUND")
find_package(OpenSSL)
if (NOT OPENSSL_FOUND)
- message(STATUS "No secure random generation, please install OpenSSL.")
+ message(FATAL_ERROR "No secure random generation, please install libssl.")
else()
- message(STATUS "OpenSSL found")
include_directories($OPENSSL_INCLUDE_DIR})
add_compile_flags(ouroboros -DHAVE_OPENSSL)
endif()
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index 67abbb5b..7660b1dd 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -117,7 +117,7 @@ struct shm_flow_set * shm_flow_set_create()
(set->fqueues + AP_MAX_FQUEUES * (SHM_BUFFER_SIZE));
pthread_mutexattr_init(&mattr);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
@@ -336,7 +336,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
assert(idx < AP_MAX_FQUEUES);
assert(fqueue);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(set->lock);
#else
if (pthread_mutex_lock(set->lock) == EOWNERDEAD)
@@ -358,7 +358,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
else
ret = -pthread_cond_wait(set->conds + idx,
set->lock);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
if (ret == -EOWNERDEAD)
pthread_mutex_consistent(set->lock);
#endif
diff --git a/src/lib/shm_rbuff_ll.c b/src/lib/shm_rbuff_ll.c
index 1e072b21..757f65c8 100644
--- a/src/lib/shm_rbuff_ll.c
+++ b/src/lib/shm_rbuff_ll.c
@@ -127,7 +127,7 @@ struct shm_rbuff * shm_rbuff_create(pid_t api, int port_id)
rb->del = rb->add + 1;
pthread_mutexattr_init(&mattr);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
@@ -299,7 +299,7 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb,
ts_add(&abstime, timeout, &abstime);
}
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -315,7 +315,7 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb,
&abstime);
else
idx = -pthread_cond_wait(rb->add, rb->lock);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
if (idx == -EOWNERDEAD)
pthread_mutex_consistent(rb->lock);
#endif
@@ -356,7 +356,7 @@ void shm_rbuff_fini(struct shm_rbuff * rb)
if (shm_rbuff_empty(rb))
return;
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -367,7 +367,7 @@ void shm_rbuff_fini(struct shm_rbuff * rb)
(void *) rb->lock);
while (!shm_rbuff_empty(rb))
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_cond_wait(rb->del, rb->lock);
#else
if (pthread_cond_wait(rb->del, rb->lock) == EOWNERDEAD)
diff --git a/src/lib/shm_rbuff_pthr.c b/src/lib/shm_rbuff_pthr.c
index d3c1e143..1b9f07d1 100644
--- a/src/lib/shm_rbuff_pthr.c
+++ b/src/lib/shm_rbuff_pthr.c
@@ -124,7 +124,7 @@ struct shm_rbuff * shm_rbuff_create(pid_t api, int port_id)
rb->del = rb->add + 1;
pthread_mutexattr_init(&mattr);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
@@ -231,7 +231,7 @@ int shm_rbuff_write(struct shm_rbuff * rb, size_t idx)
assert(rb);
assert(idx < SHM_BUFFER_SIZE);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -264,7 +264,7 @@ ssize_t shm_rbuff_read(struct shm_rbuff * rb)
assert(rb);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -297,7 +297,7 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb,
ts_add(&abstime, timeout, &abstime);
}
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -313,7 +313,7 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb,
&abstime);
else
idx = -pthread_cond_wait(rb->add, rb->lock);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
if (idx == -EOWNERDEAD)
pthread_mutex_consistent(rb->lock);
#endif
@@ -334,7 +334,7 @@ void shm_rbuff_block(struct shm_rbuff * rb)
{
assert(rb);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -349,7 +349,7 @@ void shm_rbuff_unblock(struct shm_rbuff * rb)
{
assert(rb);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -364,7 +364,7 @@ void shm_rbuff_fini(struct shm_rbuff * rb)
{
assert(rb);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
@@ -376,7 +376,7 @@ void shm_rbuff_fini(struct shm_rbuff * rb)
(void *) rb->lock);
while (!shm_rbuff_empty(rb))
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_cond_wait(rb->del, rb->lock);
#else
if (pthread_cond_wait(rb->del, rb->lock) == EOWNERDEAD)
@@ -391,7 +391,7 @@ size_t shm_rbuff_queued(struct shm_rbuff * rb)
assert(rb);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rb->lock);
#else
if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index 1f999f93..d454fef8 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -192,7 +192,7 @@ struct shm_rdrbuff * shm_rdrbuff_create()
pthread_mutexattr_init(&mattr);
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutex_init(rdrb->lock, &mattr);
@@ -274,7 +274,7 @@ int shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb,
ts_add(&abstime, timeo, &abstime);
}
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -282,9 +282,9 @@ int shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb,
#endif
while (shm_rdrb_free(rdrb, WAIT_BLOCKS)) {
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
if (pthread_cond_timedwait(rdrb->full,
- rdrb->lock
+ rdrb->lock,
&abstime) == ETIMEDOUT) {
pthread_mutex_unlock(rdrb->lock);
return -ETIMEDOUT;
@@ -358,7 +358,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
if (sz > SHM_RDRB_BLOCK_SIZE)
return -EMSGSIZE;
#endif
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -437,7 +437,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
if (sz > SHM_RDRB_BLOCK_SIZE)
return -EMSGSIZE;
#endif
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -535,7 +535,7 @@ int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb,
assert(rdrb);
assert(idx < (SHM_BUFFER_SIZE));
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
diff --git a/src/lib/tests/time_utils_test.c b/src/lib/tests/time_utils_test.c
index 6d1ae32f..86636c15 100644
--- a/src/lib/tests/time_utils_test.c
+++ b/src/lib/tests/time_utils_test.c
@@ -28,12 +28,12 @@
static void ts_print(struct timespec * s)
{
- printf("timespec is %zd:%zd.\n", s->tv_sec, s->tv_nsec);
+ printf("timespec is %zd:%ld.\n", (ssize_t) s->tv_sec, s->tv_nsec);
}
static void tv_print(struct timeval * v)
{
- printf("timeval is %zd:%zd.\n", v->tv_sec, v->tv_usec);
+ printf("timeval is %zd:%ld.\n", (ssize_t) v->tv_sec, v->tv_usec);
}
static void ts_init(struct timespec * s,