Hello, Here is a patch that adds only pthread_condattr_init/destroy, pthread_cond_timedwait, pthread_exit, and makes both cond_*wait abort instead of just returning 0.
Samuel
diff -ur libpthread-stubs-0.1-orig/configure.ac libpthread-stubs-0.1/configure.ac --- libpthread-stubs-0.1-orig/configure.ac 2006-11-22 08:51:21.000000000 +0100 +++ libpthread-stubs-0.1/configure.ac 2009-10-11 01:15:57.000000000 +0200 @@ -31,7 +31,7 @@ PKG_CONFIG_LIBS= -AC_CHECK_FUNCS([pthread_self pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_cond_init pthread_cond_destroy pthread_cond_wait pthread_cond_signal pthread_cond_broadcast pthread_equal], +AC_CHECK_FUNCS([pthread_self pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_cond_init pthread_cond_destroy pthread_condattr_init pthread_condattr_destroy pthread_cond_wait pthread_cond_timedwait pthread_cond_signal pthread_cond_broadcast pthread_equal pthread_exit], [], [PKG_CONFIG_LIBS='-L${libdir} -lpthread-stubs']) AC_SUBST([PKG_CONFIG_LIBS]) AM_CONDITIONAL(BUILD_LIB, test "x$PKG_CONFIG_LIBS" != x) diff -ur libpthread-stubs-0.1-orig/stubs.c libpthread-stubs-0.1/stubs.c --- libpthread-stubs-0.1-orig/stubs.c 2006-11-22 08:20:35.000000000 +0100 +++ libpthread-stubs-0.1/stubs.c 2009-10-11 01:20:41.000000000 +0200 @@ -25,6 +25,7 @@ */ #include <pthread.h> +#include <stdlib.h> #include "config.h" #ifndef HAVE_PTHREAD_SELF @@ -90,12 +91,39 @@ # endif #endif -#ifndef HAVE_PTHREAD_COND_WAIT +#ifndef HAVE_PTHREAD_CONDATTR_INIT +#define NEED_ZERO_STUB +# ifdef SUPPORT_ATTRIBUTE_ALIAS +int pthread_condattr_init() __attribute__ ((weak, alias ("__pthread_zero_stub"))); +# else +# pragma weak pthread_condattr_init = __pthread_zero_stub +# endif +#endif + +#ifndef HAVE_PTHREAD_CONDATTR_DESTROY #define NEED_ZERO_STUB # ifdef SUPPORT_ATTRIBUTE_ALIAS -int pthread_cond_wait() __attribute__ ((weak, alias ("__pthread_zero_stub"))); +int pthread_condattr_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub"))); +# else +# pragma weak pthread_condattr_destroy = __pthread_zero_stub +# endif +#endif + +#ifndef HAVE_PTHREAD_COND_WAIT +#define NEED_ABORT_STUB +# ifdef SUPPORT_ATTRIBUTE_ALIAS +int pthread_cond_wait() __attribute__ ((weak, alias ("__pthread_abort_stub"))); # else -# pragma weak pthread_cond_wait = __pthread_zero_stub +# pragma weak pthread_cond_wait = __pthread_abort_stub +# endif +#endif + +#ifndef HAVE_PTHREAD_COND_TIMEDWAIT +#define NEED_ABORT_STUB +# ifdef SUPPORT_ATTRIBUTE_ALIAS +int pthread_cond_timedwait() __attribute__ ((weak, alias ("__pthread_abort_stub"))); +# else +# pragma weak pthread_cond_timedwait = __pthread_abort_stub # endif #endif @@ -126,6 +154,15 @@ # endif #endif +#ifndef HAVE_PTHREAD_EXIT +#define NEED_EXIT_STUB +# ifdef SUPPORT_ATTRIBUTE_ALIAS +int pthread_exit() __attribute__ ((weak, alias ("__pthread_exit_stub"))); +# else +# pragma weak pthread_exit = __pthread_exit_stub +# endif +#endif + #ifdef NEED_ZERO_STUB static int __pthread_zero_stub() { @@ -133,9 +170,23 @@ } #endif +#ifdef NEED_ABORT_STUB +static int __pthread_abort_stub() +{ + abort(); +} +#endif + #ifdef NEED_EQUAL_STUB static int __pthread_equal_stub(pthread_t t1, pthread_t t2) { return (t1 == t2); } #endif + +#ifdef NEED_EXIT_STUB +static void __pthread_exit_stub(void *ret) +{ + exit(EXIT_SUCCESS); +} +#endif