1 From 05b6a7550756ffdced25a6c51cf2222bad9e59e7 Mon Sep 17 00:00:00 2001
2 Message-Id: <05b6a7550756ffdced25a6c51cf2222bad9e59e7.1399285491.git.baruch@tkos.co.il>
3 From: Baruch Siach <baruch@tkos.co.il>
4 Date: Mon, 5 May 2014 09:32:23 +0300
5 Subject: [PATCH] Fix build against older pthreads implementations
7 Older pthreads implementations like glibc NPTL prior to version 2.12, and
8 uClibc linuxthreads (both), need _XOPEN_SOURCE to expose
9 pthread_mutexattr_settype() and THREAD_MUTEX_DEFAULT. The value 600 (SuSv3,
10 POSIX.1-2001) is equivalent to _POSIX_C_SOURCE 200112L.
12 Fixes the following build error:
15 compat.c: In function 'p11_mutex_init':
16 compat.c:164:2: warning: implicit declaration of function 'pthread_mutexattr_settype' [-Wimplicit-function-declaration]
17 compat.c:164:2: warning: nested extern declaration of 'pthread_mutexattr_settype' [-Wnested-externs]
18 compat.c:164:36: error: 'PTHREAD_MUTEX_DEFAULT' undeclared (first use in this function)
20 Patch status: sent upstream
22 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
24 common/compat.h | 6 ++++++
25 common/message.c | 6 ------
26 2 files changed, 6 insertions(+), 6 deletions(-)
28 diff --git a/common/compat.h b/common/compat.h
29 index d7fe414a46bf..fbc1dc1d4f0f 100644
37 + * Oh god. glibc is nasty. Changes behavior and definitions of POSIX
38 + * functions to completely different signatures depending on defines
40 +#define _XOPEN_SOURCE 600
42 #include <sys/types.h>
45 diff --git a/common/message.c b/common/message.c
46 index 35f2764487a9..e68dfac561c8 100644
47 --- a/common/message.c
48 +++ b/common/message.c
54 - * Oh god. glibc is nasty. Changes behavior and definitions of POSIX
55 - * functions to completely different signatures depending on defines
57 -#define _POSIX_C_SOURCE 200112L
60 #define P11_DEBUG_FLAG P11_DEBUG_LIB