From: Nicholas N. <nj...@ca...> - 2003-07-03 08:26:43
|
On Wed, 2 Jul 2003, Matt Peebles wrote: > I'm using a valgrind 1.9.6 binary on RedHat 9 that I downloaded from > http://dag.wieers.com/packages/valgrind/ > > and my program stops after the following message is displayed: > > ==14694== valgrind's libpthread.so: UNIMPLEMENTED FUNCTION: pthread_mutexattr_setpshared > > Do I need to compile my own binary to get around this problem? No, the problem is that Valgrind's implementation of pthreads doesn't support this function. You might be able to get things working by adding a partial implementation of pthread_mutexattr_setpshared. Try the patch below... if the 'pshared' attribute is PTHREAD_PROCESS_PRIVATE it will succeed, and do nothing, which should be ok, since Valgrind's mutexes are 'private' by default. If the 'pshared' attribute is PTHREAD_PROCESS_SHARED, it will fail with ENOSYS, meaning "can't handle this request". This might get things working if your program doesn't rely on having process-shared mutexes. I'd like to know if this works for you; if so it should probably be folded into the main branch. Thanks. N Index: coregrind/vg_libpthread.c =================================================================== RCS file: /cvsroot/valgrind/valgrind/coregrind/vg_libpthread.c,v retrieving revision 1.127 diff -u -3 -p -r1.127 vg_libpthread.c --- coregrind/vg_libpthread.c 13 Jun 2003 12:24:41 -0000 1.127 +++ coregrind/vg_libpthread.c 3 Jul 2003 08:13:22 -0000 @@ -906,6 +906,10 @@ int __pthread_mutexattr_destroy(pthread_ return 0; } +int pthread_mutexattr_setpshared ( pthread_mutexattr_t* attr, int pshared) +{ + return ENOSYS; +} /* --------------------------------------------------- MUTEXes Index: coregrind/vg_libpthread_unimp.c =================================================================== RCS file: /cvsroot/valgrind/valgrind/coregrind/vg_libpthread_unimp.c,v retrieving revision 1.40 diff -u -3 -p -r1.40 vg_libpthread_unimp.c --- coregrind/vg_libpthread_unimp.c 26 Apr 2003 21:19:53 -0000 1.40 +++ coregrind/vg_libpthread_unimp.c 3 Jul 2003 08:13:22 -0000 @@ -251,8 +251,8 @@ __attribute__((weak)) void pthread_mutex { vgPlain_unimp("pthread_mutexattr_gettype"); } __attribute__((weak)) void pthread_mutexattr_setkind_np ( void ) { vgPlain_unimp("pthread_mutexattr_setkind_np"); } -__attribute__((weak)) void pthread_mutexattr_setpshared ( void ) - { vgPlain_unimp("pthread_mutexattr_setpshared"); } +//__attribute__((weak)) void pthread_mutexattr_setpshared ( void ) +// { vgPlain_unimp("pthread_mutexattr_setpshared"); } //__attribute__((weak)) void pthread_setconcurrency ( void ) // { vgPlain_unimp("pthread_setconcurrency"); } __attribute__((weak)) void pthread_spin_destroy ( void ) |