|
From: <sv...@va...> - 2014-02-08 10:55:19
|
Author: bart
Date: Sat Feb 8 10:55:08 2014
New Revision: 13792
Log:
drd: Avoid that the drd/tests/pth_mutex_reinit test fails with glibc >= 2.18
Apparently with glibc >= 2.18 the value returned by pthread_mutexattr_gettype()
is not the same as the value passed to pthread_mutexattr_settype(). Add a
workaround for this glibc bug.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
==============================================================================
--- trunk/drd/drd_pthread_intercepts.c (original)
+++ trunk/drd/drd_pthread_intercepts.c Sat Feb 8 10:55:08 2014
@@ -243,8 +243,14 @@
* statement because some of the PTHREAD_MUTEX_ macro's may have the same
* value.
*/
-static MutexT DRD_(pthread_to_drd_mutex_type)(const int kind)
+static MutexT DRD_(pthread_to_drd_mutex_type)(int kind)
{
+ /*
+ * See also PTHREAD_MUTEX_KIND_MASK_NP in glibc source file
+ * <nptl/pthreadP.h>.
+ */
+ kind &= 3;
+
if (kind == PTHREAD_MUTEX_RECURSIVE)
return mutex_type_recursive_mutex;
else if (kind == PTHREAD_MUTEX_ERRORCHECK)
@@ -258,9 +264,7 @@
return mutex_type_default_mutex;
#endif
else
- {
return mutex_type_invalid_mutex;
- }
}
#define IS_ALIGNED(p) (((uintptr_t)(p) & (sizeof(*(p)) - 1)) == 0)
|