blob: efa6d060a0128302614a430c9c5848988c59c46d [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 00ba7cdd0608b1507027428f9f87b1cb9747372b Mon Sep 17 00:00:00 2001
2From: Dengke Du <dengke.du@windriver.com>
3Date: Thu, 9 Feb 2017 15:54:53 +0800
4Subject: [PATCH] lib: Use PTHREAD_MUTEX_RECURSIVE in place of
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005 PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP for non-glibc
6
7e.g. musl does not implement the _NP mutex types
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010Signed-off-by: Dengke Du <dengke.du@windriver.com>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011
12Upstream-Status: Pending
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050013---
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 lib/tst_res.c | 4 ++++
15 1 file changed, 4 insertions(+)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050016
17diff --git a/lib/tst_res.c b/lib/tst_res.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018index 61daaeb..435224f 100644
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019--- a/lib/tst_res.c
20+++ b/lib/tst_res.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021@@ -79,7 +79,11 @@ int TEST_ERRNO;
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050022 assert(strlen(buf) > 0); \
23 } while (0)
24
25+#ifdef __GLIBC__
26 static pthread_mutex_t tmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050027+#else
28+static pthread_mutex_t tmutex = { PTHREAD_MUTEX_RECURSIVE };
29+#endif
Brad Bishop6e60e8b2018-02-01 10:27:11 -050030
31 static void check_env(void);
32 static void tst_condense(int tnum, int ttype, const char *tmesg);
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050033--
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500342.7.4
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050035