summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2014-05-05 09:32:23 +0300
committerStef Walter <stef@thewalter.net>2014-08-14 17:37:49 +0200
commitbf8dfa9f33c1aa8d76f8d1ae6cf79afb90497cd4 (patch)
treec0e14d745807c6ef5f7bf6fa08aa9d5cdc4a87f5
parentea10b26125eff14d5b138ceb0e55994bd38f7381 (diff)
Fix build against older pthreads implementations
Older pthreads implementations like glibc NPTL prior to version 2.12, and uClibc linuxthreads (both), need _XOPEN_SOURCE to expose pthread_mutexattr_settype() and THREAD_MUTEX_DEFAULT. The value 600 (SuSv3, POSIX.1-2001) is equivalent to _POSIX_C_SOURCE 200112L. Fixes the following build error: CC compat.lo compat.c: In function 'p11_mutex_init': compat.c:164:2: warning: implicit declaration of function 'pthread_mutexattr_settype' [-Wimplicit-function-declaration] compat.c:164:2: warning: nested extern declaration of 'pthread_mutexattr_settype' [-Wnested-externs] compat.c:164:36: error: 'PTHREAD_MUTEX_DEFAULT' undeclared (first use in this function) https://bugs.freedesktop.org/show_bug.cgi?id=82617
-rw-r--r--common/compat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/compat.c b/common/compat.c
index 9314d20..1c8ab87 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -34,6 +34,12 @@
#include "config.h"
+/*
+ * This is needed to expose pthread_mutexattr_settype and PTHREAD_MUTEX_DEFAULT
+ * on older pthreads implementations
+ */
+#define _XOPEN_SOURCE 600
+
#include "compat.h"
#include <assert.h>