From: Bart Van Assche Date: Sat, 5 Apr 2008 12:53:15 +0000 (+0000) Subject: Presence of pthread_mutex_t::__m_kind or pthread_mutex_t::__data.__kind is now detect... X-Git-Tag: svn/VALGRIND_3_4_0~753 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94c9786ea11995986061e9d09b3547a68a27e97a;p=thirdparty%2Fvalgrind.git Presence of pthread_mutex_t::__m_kind or pthread_mutex_t::__data.__kind is now detected by configure. DRD now halts if configure could not find either of these two data members. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7846 --- diff --git a/configure.in b/configure.in index 6ed26fa7d2..18274151d4 100644 --- a/configure.in +++ b/configure.in @@ -550,6 +550,50 @@ if test "${no_x}" != 'yes' ; then fi +# Check whether pthread_mutex_t has a member called __m_kind. + +AC_MSG_CHECKING([for pthread_mutex_t::__m_kind]) + +AC_COMPILE_IFELSE( +[ +#include +int main(int argc, char** argv) +{ + pthread_mutex_t m; + return m.__m_kind; +} +], +[ +AC_MSG_RESULT([yes]) +AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1, + [Define to 1 if pthread_mutex_t has a member called __m_kind.]) +], [ +AC_MSG_RESULT([no]) +]) + + +# Check whether pthread_mutex_t has a member called __data.__kind. + +AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind]) + +AC_COMPILE_IFELSE( +[ +#include +int main(int argc, char** argv) +{ + pthread_mutex_t m; + return m.__data.__kind; +} +], +[ +AC_MSG_RESULT([yes]) +AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1, + [Define to 1 if pthread_mutex_t has a member __data.__kind.]) +], [ +AC_MSG_RESULT([no]) +]) + + # does this compiler support -fopenmp, does it have the include file # and does it have libgomp ? diff --git a/exp-drd/drd_pthread_intercepts.c b/exp-drd/drd_pthread_intercepts.c index 2c1b7734da..36793c6812 100644 --- a/exp-drd/drd_pthread_intercepts.c +++ b/exp-drd/drd_pthread_intercepts.c @@ -53,6 +53,7 @@ #include #include #include // confstr() +#include "config.h" #include "drd_clientreq.h" #include "pub_tool_redir.h" @@ -120,15 +121,18 @@ static MutexT pthread_to_drd_mutex_type(const int kind) static MutexT mutex_type(pthread_mutex_t* mutex) { -#if defined(_PTHREAD_DESCR_DEFINED) - // Linuxthreads. +#if defined(HAVE_PTHREAD_MUTEX_T__M_KIND) + /* LinuxThreads. */ const int kind = mutex->__m_kind; -#elif defined(__SIZEOF_PTHREAD_MUTEX_T) - // NPTL. +#elif defined(HAVE_PTHREAD_MUTEX_T__DATA__KIND) + /* NPTL. */ const int kind = mutex->__data.__kind; #else - // Another POSIX threads implementation. Regression tests will fail. + /* Another POSIX threads implementation. Regression tests will fail. */ const int kind = PTHREAD_MUTEX_DEFAULT; + fprintf(stderr, + "Did not recognize your POSIX threads implementation. Giving up.\n"); + assert(0); #endif return pthread_to_drd_mutex_type(kind); }