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