]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Made DRD_(mutex_type) ignore mutex attribute flags.
authorBart Van Assche <bvanassche@acm.org>
Fri, 13 Mar 2009 17:32:52 +0000 (17:32 +0000)
committerBart Van Assche <bvanassche@acm.org>
Fri, 13 Mar 2009 17:32:52 +0000 (17:32 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9399

drd/drd_pthread_intercepts.c

index 0898cfc47a3e28c1affa5847e8675bdcaf033c72..3c9ef5da84d35f4a3ee78b99cbf552ba23ecf047 100644 (file)
@@ -156,15 +156,18 @@ static MutexT DRD_(pthread_to_drd_mutex_type)(const int kind)
  *   which the mutex type is stored.
  * @note The function mutex_type() has been declared inline in order
  *   to avoid that it shows up in call stacks (drd/tests/...exp* files).
+ * @note glibc stores the mutex type in the lowest two bits, and uses the
+ *   higher bits for flags like PTHREAD_MUTEXATTR_FLAG_ROBUST and
+ *   PTHREAD_MUTEXATTR_FLAG_PSHARED.
  */
 static __inline__ MutexT DRD_(mutex_type)(pthread_mutex_t* mutex)
 {
 #if defined(HAVE_PTHREAD_MUTEX_T__M_KIND)
   /* glibc + LinuxThreads. */
-  const int kind = mutex->__m_kind;
+  const int kind = mutex->__m_kind & 3;
 #elif defined(HAVE_PTHREAD_MUTEX_T__DATA__KIND)
   /* glibc + NPTL. */
-  const int kind = mutex->__data.__kind;
+  const int kind = mutex->__data.__kind & 3;
 #else
   /* Another POSIX threads implementation. Regression tests will fail. */
   const int kind = PTHREAD_MUTEX_DEFAULT;