From: Paul Floyd Date: Wed, 2 Apr 2025 19:39:54 +0000 (+0200) Subject: Illumos helgrind: pthread wrapper tweaks X-Git-Tag: VALGRIND_3_25_0~64 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e633d2c8c56d342726f98d55e42c6fbdc875bd54;p=thirdparty%2Fvalgrind.git Illumos helgrind: pthread wrapper tweaks Wrap pthread_cond_timedwait which seems to have supplanted cond_reltimedwait on Illumos. pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock both exist on illumos, so enable those wrappers. --- diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 950d71b83..661ab1a09 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -1526,6 +1526,11 @@ static int pthread_cond_timedwait_WRK(pthread_cond_t* cond, struct timespec *reltime) { return pthread_cond_timedwait_WRK(cond, mutex, reltime, ETIME); } + PTH_FUNC(int, pthreadZucondZutimedwait, // pthread_cond_timedwait + pthread_cond_t* cond, pthread_mutex_t* mutex, + struct timespec* abstime) { + return pthread_cond_timedwait_WRK(cond, mutex, abstime, ETIMEDOUT); + } #else # error "Unsupported OS" #endif @@ -2810,7 +2815,7 @@ PTH_FUNC(int, pthreadZurwlockZutimedrdlock, // pthread_rwlock_timedrdlock # error "Unsupported OS" #endif -#if defined(VGO_linux) +#if defined(VGO_linux) || defined(VGO_solaris) //----------------------------------------------------------- // glibc: pthread_rwlock_clockrdlock // @@ -2917,7 +2922,7 @@ PTH_FUNC(int, pthreadZurwlockZutimedwrlock, // pthread_rwlock_timedwrlock # error "Unsupported OS" #endif -#if defined(VGO_linux) +#if defined(VGO_linux) || defined(VGO_solaris) //----------------------------------------------------------- // glibc: pthread_rwlock_clockwrlock // diff --git a/helgrind/tests/filter_stderr_solaris b/helgrind/tests/filter_stderr_solaris index 41d1f1ef5..56ecfb3fb 100755 --- a/helgrind/tests/filter_stderr_solaris +++ b/helgrind/tests/filter_stderr_solaris @@ -2,6 +2,8 @@ # Replace pthread_create with pthread_create@* which is expected on Linux s/pthread_create \(hg_intercepts.c:/pthread_create@* \(hg_intercepts.c:/g; +# Illumos uses pthread function names (in some cases?) +s/pthread_cond_timedwait \(hg_intercepts.c:/pthread_cond_timedwait@* \(hg_intercepts.c:/; # We need to remove stack frames containing redundant function # names from libc, for example