val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
}
}
+void vgPlain_unimp ( char* what )
+{
+ char* ig = "vg_libpthread.so: UNIMPLEMENTED FUNCTION: ";
+ write(2, ig, strlen(ig));
+ write(2, what, strlen(what));
+ ig = "\n";
+ write(2, ig, strlen(ig));
+ barf("Please report this bug to me at: jseward@acm.org");
+}
+
/* ---------------------------------------------------------------------
Pass pthread_ calls to Valgrind's request mechanism.
}
-static int thread_specific_errno[VG_N_THREADS];
-
-int* __errno_location ( void )
+pthread_t pthread_self(void)
{
int tid;
- /* ensure_valgrind("__errno_location"); */
+ ensure_valgrind("pthread_self");
VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
- /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("__errno_location: invalid ThreadId");
- return & thread_specific_errno[tid];
+ barf("pthread_self: invalid ThreadId");
+ return tid;
}
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
-#ifndef GLIBC_2_1
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
case PTHREAD_MUTEX_ADAPTIVE_NP:
-#endif
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
attr->__mutexkind = type;
/* ---------------------------------------------------
- MISC
+ LIBRARY-PRIVATE THREAD SPECIFIC STATE
------------------------------------------------ */
-/* What are these? Anybody know? I don't. */
+#include <resolv.h>
+static int thread_specific_errno[VG_N_THREADS];
+static int thread_specific_h_errno[VG_N_THREADS];
+static struct __res_state
+ thread_specific_res_state[VG_N_THREADS];
-void _pthread_cleanup_push_defer ( void )
+int* __errno_location ( void )
{
- // char* str = "_pthread_cleanup_push_defer\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__errno_location: invalid ThreadId");
+ return & thread_specific_errno[tid];
}
-void _pthread_cleanup_pop_restore ( void )
+int* __h_errno_location ( void )
{
- // char* str = "_pthread_cleanup_pop_restore\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__h_errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__h_errno_location: invalid ThreadId");
+ return & thread_specific_h_errno[tid];
}
-
-pthread_t pthread_self(void)
+struct __res_state* __res_state ( void )
{
int tid;
- ensure_valgrind("pthread_self");
- VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
+ /* ensure_valgrind("__res_state"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("pthread_self: invalid ThreadId");
- return tid;
+ barf("__res_state: invalid ThreadId");
+ return & thread_specific_res_state[tid];
}
}
-/*--------------------------------------------------*/
-
-/* I've no idea what these are, but they get called quite a lot.
- Anybody know? */
-
-#undef _IO_flockfile
-void _IO_flockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_flockfile\n";
- // write(2, str, strlen(str));
- // barf("_IO_flockfile");
-}
-
-#undef _IO_funlockfile
-void _IO_funlockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_funlockfile\n";
- // write(2, str, strlen(str));
- //barf("_IO_funlockfile");
-}
+/* ---------------------------------------------------------------------
+ Nonblocking implementations of select() and poll(). This stuff will
+ surely rot your mind.
+ ------------------------------------------------------------------ */
/*--------------------------------------------------*/
(int)(&nanosleep_interval), (int)NULL);
}
}
+
+
+/* ---------------------------------------------------------------------
+ B'stard.
+ ------------------------------------------------------------------ */
+
+# define strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
+strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+strong_alias(pthread_mutexattr_init, __pthread_mutexattr_init)
+strong_alias(pthread_mutexattr_settype, __pthread_mutexattr_settype)
+strong_alias(pthread_mutex_init, __pthread_mutex_init)
+strong_alias(pthread_mutexattr_destroy, __pthread_mutexattr_destroy)
+strong_alias(pthread_mutex_destroy, __pthread_mutex_destroy)
+strong_alias(pthread_once, __pthread_once)
+
+strong_alias(close, __close)
+strong_alias(write, __write)
+strong_alias(read, __read)
+strong_alias(open, __open)
+strong_alias(sigaction, __sigaction)
+
+strong_alias(pthread_key_create, __pthread_key_create)
+strong_alias(pthread_getspecific, __pthread_getspecific)
+strong_alias(pthread_setspecific, __pthread_setspecific)
+strong_alias(open64, __open64)
+strong_alias(fcntl, __fcntl)
+strong_alias(connect, __connect)
+
+/*--------------------------------------------------*/
+
+/* I've no idea what these are, but they get called quite a lot.
+ Anybody know? */
+
+#undef _IO_flockfile
+void _IO_flockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_flockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_flockfile");
+}
+
+#undef _IO_funlockfile
+void _IO_funlockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_funlockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_funlockfile");
+}
+
+void _pthread_cleanup_push_defer ( void )
+{
+ // char* str = "_pthread_cleanup_push_defer\n";
+ // write(2, str, strlen(str));
+}
+
+void _pthread_cleanup_pop_restore ( void )
+{
+ // char* str = "_pthread_cleanup_pop_restore\n";
+ // write(2, str, strlen(str));
+}
--- /dev/null
+
+/* ---------------------------------------------------------------------
+ Give a binding for everything the real libpthread.so binds.
+ ------------------------------------------------------------------ */
+
+extern void vgPlain_unimp ( char* );
+#define unimp(str) vgPlain_unimp(str)
+
+//void _IO_flockfile ( void ) { unimp("_IO_flockfile"); }
+void _IO_ftrylockfile ( void ) { unimp("_IO_ftrylockfile"); }
+//void _IO_funlockfile ( void ) { unimp("_IO_funlockfile"); }
+//void __close ( void ) { unimp("__close"); }
+//void __connect ( void ) { unimp("__connect"); }
+//void __errno_location ( void ) { unimp("__errno_location"); }
+//void __fcntl ( void ) { unimp("__fcntl"); }
+void __fork ( void ) { unimp("__fork"); }
+//void __h_errno_location ( void ) { unimp("__h_errno_location"); }
+void __libc_allocate_rtsig ( void ) { unimp("__libc_allocate_rtsig"); }
+void __libc_current_sigrtmax ( void ) { unimp("__libc_current_sigrtmax"); }
+void __libc_current_sigrtmin ( void ) { unimp("__libc_current_sigrtmin"); }
+void __lseek ( void ) { unimp("__lseek"); }
+//void __open ( void ) { unimp("__open"); }
+//void __open64 ( void ) { unimp("__open64"); }
+void __pread64 ( void ) { unimp("__pread64"); }
+void __pthread_atfork ( void ) { unimp("__pthread_atfork"); }
+//void __pthread_getspecific ( void ) { unimp("__pthread_getspecific"); }
+//void __pthread_key_create ( void ) { unimp("__pthread_key_create"); }
+void __pthread_kill_other_threads_np ( void ) { unimp("__pthread_kill_other_threads_np"); }
+//void __pthread_mutex_destroy ( void ) { unimp("__pthread_mutex_destroy"); }
+//void __pthread_mutex_init ( void ) { unimp("__pthread_mutex_init"); }
+//void __pthread_mutex_lock ( void ) { unimp("__pthread_mutex_lock"); }
+void __pthread_mutex_trylock ( void ) { unimp("__pthread_mutex_trylock"); }
+//void __pthread_mutex_unlock ( void ) { unimp("__pthread_mutex_unlock"); }
+//void __pthread_mutexattr_destroy ( void ) { unimp("__pthread_mutexattr_destroy"); }
+//void __pthread_mutexattr_init ( void ) { unimp("__pthread_mutexattr_init"); }
+//void __pthread_mutexattr_settype ( void ) { unimp("__pthread_mutexattr_settype"); }
+//void __pthread_once ( void ) { unimp("__pthread_once"); }
+//void __pthread_setspecific ( void ) { unimp("__pthread_setspecific"); }
+void __pwrite64 ( void ) { unimp("__pwrite64"); }
+//void __read ( void ) { unimp("__read"); }
+//void __res_state ( void ) { unimp("__res_state"); }
+void __send ( void ) { unimp("__send"); }
+//void __sigaction ( void ) { unimp("__sigaction"); }
+void __vfork ( void ) { unimp("__vfork"); }
+void __wait ( void ) { unimp("__wait"); }
+//void __write ( void ) { unimp("__write"); }
+void _pthread_cleanup_pop ( void ) { unimp("_pthread_cleanup_pop"); }
+//void _pthread_cleanup_pop_restore ( void ) { unimp("_pthread_cleanup_pop_restore"); }
+void _pthread_cleanup_push ( void ) { unimp("_pthread_cleanup_push"); }
+//void _pthread_cleanup_push_defer ( void ) { unimp("_pthread_cleanup_push_defer"); }
+//void longjmp ( void ) { unimp("longjmp"); }
+void pthread_atfork ( void ) { unimp("pthread_atfork"); }
+//void pthread_attr_destroy ( void ) { unimp("pthread_attr_destroy"); }
+void pthread_attr_getdetachstate ( void ) { unimp("pthread_attr_getdetachstate"); }
+void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); }
+//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); }
+void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); }
+void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
+
+//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); }
+//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); }
+//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); }
+void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); }
+void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
+void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); }
+void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); }
+void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); }
+void pthread_barrierattr_destroy ( void ) { unimp("pthread_barrierattr_destroy"); }
+void pthread_barrierattr_init ( void ) { unimp("pthread_barrierattr_init"); }
+void pthread_barrierattr_setpshared ( void ) { unimp("pthread_barrierattr_setpshared"); }
+//void pthread_cancel ( void ) { unimp("pthread_cancel"); }
+//void pthread_cond_broadcast ( void ) { unimp("pthread_cond_broadcast"); }
+//void pthread_cond_destroy ( void ) { unimp("pthread_cond_destroy"); }
+//void pthread_cond_init ( void ) { unimp("pthread_cond_init"); }
+//void pthread_cond_signal ( void ) { unimp("pthread_cond_signal"); }
+//void pthread_cond_timedwait ( void ) { unimp("pthread_cond_timedwait"); }
+//void pthread_cond_wait ( void ) { unimp("pthread_cond_wait"); }
+//void pthread_condattr_destroy ( void ) { unimp("pthread_condattr_destroy"); }
+void pthread_condattr_getpshared ( void ) { unimp("pthread_condattr_getpshared"); }
+//void pthread_condattr_init ( void ) { unimp("pthread_condattr_init"); }
+void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared"); }
+void pthread_detach ( void ) { unimp("pthread_detach"); }
+//void pthread_equal ( void ) { unimp("pthread_equal"); }
+//void pthread_exit ( void ) { unimp("pthread_exit"); }
+void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); }
+void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); }
+//void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); }
+//void pthread_getspecific ( void ) { unimp("pthread_getspecific"); }
+//void pthread_join ( void ) { unimp("pthread_join"); }
+//void pthread_key_create ( void ) { unimp("pthread_key_create"); }
+//void pthread_key_delete ( void ) { unimp("pthread_key_delete"); }
+void pthread_kill ( void ) { unimp("pthread_kill"); }
+//void pthread_mutex_destroy ( void ) { unimp("pthread_mutex_destroy"); }
+//void pthread_mutex_init ( void ) { unimp("pthread_mutex_init"); }
+//void pthread_mutex_lock ( void ) { unimp("pthread_mutex_lock"); }
+void pthread_mutex_timedlock ( void ) { unimp("pthread_mutex_timedlock"); }
+//void pthread_mutex_trylock ( void ) { unimp("pthread_mutex_trylock"); }
+//void pthread_mutex_unlock ( void ) { unimp("pthread_mutex_unlock"); }
+//void pthread_mutexattr_destroy ( void ) { unimp("pthread_mutexattr_destroy"); }
+//void pthread_mutexattr_init ( void ) { unimp("pthread_mutexattr_init"); }
+//void pthread_once ( void ) { unimp("pthread_once"); }
+void pthread_rwlock_destroy ( void ) { unimp("pthread_rwlock_destroy"); }
+void pthread_rwlock_init ( void ) { unimp("pthread_rwlock_init"); }
+void pthread_rwlock_rdlock ( void ) { unimp("pthread_rwlock_rdlock"); }
+void pthread_rwlock_timedrdlock ( void ) { unimp("pthread_rwlock_timedrdlock"); }
+void pthread_rwlock_timedwrlock ( void ) { unimp("pthread_rwlock_timedwrlock"); }
+void pthread_rwlock_tryrdlock ( void ) { unimp("pthread_rwlock_tryrdlock"); }
+void pthread_rwlock_trywrlock ( void ) { unimp("pthread_rwlock_trywrlock"); }
+void pthread_rwlock_unlock ( void ) { unimp("pthread_rwlock_unlock"); }
+void pthread_rwlock_wrlock ( void ) { unimp("pthread_rwlock_wrlock"); }
+void pthread_rwlockattr_destroy ( void ) { unimp("pthread_rwlockattr_destroy"); }
+void pthread_rwlockattr_getkind_np ( void ) { unimp("pthread_rwlockattr_getkind_np"); }
+void pthread_rwlockattr_getpshared ( void ) { unimp("pthread_rwlockattr_getpshared"); }
+void pthread_rwlockattr_init ( void ) { unimp("pthread_rwlockattr_init"); }
+void pthread_rwlockattr_setkind_np ( void ) { unimp("pthread_rwlockattr_setkind_np"); }
+void pthread_rwlockattr_setpshared ( void ) { unimp("pthread_rwlockattr_setpshared"); }
+//void pthread_self ( void ) { unimp("pthread_self"); }
+void pthread_setcancelstate ( void ) { unimp("pthread_setcancelstate"); }
+//void pthread_setcanceltype ( void ) { unimp("pthread_setcanceltype"); }
+//void pthread_setschedparam ( void ) { unimp("pthread_setschedparam"); }
+//void pthread_setspecific ( void ) { unimp("pthread_setspecific"); }
+void pthread_sigmask ( void ) { unimp("pthread_sigmask"); }
+void pthread_testcancel ( void ) { unimp("pthread_testcancel"); }
+void raise ( void ) { unimp("raise"); }
+void sem_close ( void ) { unimp("sem_close"); }
+void sem_open ( void ) { unimp("sem_open"); }
+void sem_timedwait ( void ) { unimp("sem_timedwait"); }
+void sem_unlink ( void ) { unimp("sem_unlink"); }
+//void sigaction ( void ) { unimp("sigaction"); }
+void siglongjmp ( void ) { unimp("siglongjmp"); }
+void sigwait ( void ) { unimp("sigwait"); }
+
+#if 0
+void pthread_create@@GLIBC_2.1 ( void ) { unimp("pthread_create@@GLIBC_2.1"); }
+void pthread_create@GLIBC_2.0 ( void ) { unimp("pthread_create@GLIBC_2.0"); }
+
+void sem_wait@@GLIBC_2.1 ( void ) { unimp("sem_wait@@GLIBC_2.1"); }
+void sem_wait@GLIBC_2.0 ( void ) { unimp("sem_wait@GLIBC_2.0"); }
+
+void sem_trywait@@GLIBC_2.1 ( void ) { unimp("sem_trywait@@GLIBC_2.1"); }
+void sem_trywait@GLIBC_2.0 ( void ) { unimp("sem_trywait@GLIBC_2.0"); }
+
+void sem_post@@GLIBC_2.1 ( void ) { unimp("sem_post@@GLIBC_2.1"); }
+void sem_post@GLIBC_2.0 ( void ) { unimp("sem_post@GLIBC_2.0"); }
+
+void sem_destroy@@GLIBC_2.1 ( void ) { unimp("sem_destroy@@GLIBC_2.1"); }
+void sem_destroy@GLIBC_2.0 ( void ) { unimp("sem_destroy@GLIBC_2.0"); }
+void sem_getvalue@@GLIBC_2.1 ( void ) { unimp("sem_getvalue@@GLIBC_2.1"); }
+void sem_getvalue@GLIBC_2.0 ( void ) { unimp("sem_getvalue@GLIBC_2.0"); }
+void sem_init@@GLIBC_2.1 ( void ) { unimp("sem_init@@GLIBC_2.1"); }
+void sem_init@GLIBC_2.0 ( void ) { unimp("sem_init@GLIBC_2.0"); }
+
+void pthread_attr_init@@GLIBC_2.1 ( void ) { unimp("pthread_attr_init@@GLIBC_2.1"); }
+void pthread_attr_init@GLIBC_2.0 ( void ) { unimp("pthread_attr_init@GLIBC_2.0"); }
+#endif
}
}
+void vgPlain_unimp ( char* what )
+{
+ char* ig = "vg_libpthread.so: UNIMPLEMENTED FUNCTION: ";
+ write(2, ig, strlen(ig));
+ write(2, what, strlen(what));
+ ig = "\n";
+ write(2, ig, strlen(ig));
+ barf("Please report this bug to me at: jseward@acm.org");
+}
+
/* ---------------------------------------------------------------------
Pass pthread_ calls to Valgrind's request mechanism.
}
-static int thread_specific_errno[VG_N_THREADS];
-
-int* __errno_location ( void )
+pthread_t pthread_self(void)
{
int tid;
- /* ensure_valgrind("__errno_location"); */
+ ensure_valgrind("pthread_self");
VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
- /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("__errno_location: invalid ThreadId");
- return & thread_specific_errno[tid];
+ barf("pthread_self: invalid ThreadId");
+ return tid;
}
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
-#ifndef GLIBC_2_1
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
case PTHREAD_MUTEX_ADAPTIVE_NP:
-#endif
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
attr->__mutexkind = type;
/* ---------------------------------------------------
- MISC
+ LIBRARY-PRIVATE THREAD SPECIFIC STATE
------------------------------------------------ */
-/* What are these? Anybody know? I don't. */
+#include <resolv.h>
+static int thread_specific_errno[VG_N_THREADS];
+static int thread_specific_h_errno[VG_N_THREADS];
+static struct __res_state
+ thread_specific_res_state[VG_N_THREADS];
-void _pthread_cleanup_push_defer ( void )
+int* __errno_location ( void )
{
- // char* str = "_pthread_cleanup_push_defer\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__errno_location: invalid ThreadId");
+ return & thread_specific_errno[tid];
}
-void _pthread_cleanup_pop_restore ( void )
+int* __h_errno_location ( void )
{
- // char* str = "_pthread_cleanup_pop_restore\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__h_errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__h_errno_location: invalid ThreadId");
+ return & thread_specific_h_errno[tid];
}
-
-pthread_t pthread_self(void)
+struct __res_state* __res_state ( void )
{
int tid;
- ensure_valgrind("pthread_self");
- VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
+ /* ensure_valgrind("__res_state"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("pthread_self: invalid ThreadId");
- return tid;
+ barf("__res_state: invalid ThreadId");
+ return & thread_specific_res_state[tid];
}
}
-/*--------------------------------------------------*/
-
-/* I've no idea what these are, but they get called quite a lot.
- Anybody know? */
-
-#undef _IO_flockfile
-void _IO_flockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_flockfile\n";
- // write(2, str, strlen(str));
- // barf("_IO_flockfile");
-}
-
-#undef _IO_funlockfile
-void _IO_funlockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_funlockfile\n";
- // write(2, str, strlen(str));
- //barf("_IO_funlockfile");
-}
+/* ---------------------------------------------------------------------
+ Nonblocking implementations of select() and poll(). This stuff will
+ surely rot your mind.
+ ------------------------------------------------------------------ */
/*--------------------------------------------------*/
(int)(&nanosleep_interval), (int)NULL);
}
}
+
+
+/* ---------------------------------------------------------------------
+ B'stard.
+ ------------------------------------------------------------------ */
+
+# define strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
+strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+strong_alias(pthread_mutexattr_init, __pthread_mutexattr_init)
+strong_alias(pthread_mutexattr_settype, __pthread_mutexattr_settype)
+strong_alias(pthread_mutex_init, __pthread_mutex_init)
+strong_alias(pthread_mutexattr_destroy, __pthread_mutexattr_destroy)
+strong_alias(pthread_mutex_destroy, __pthread_mutex_destroy)
+strong_alias(pthread_once, __pthread_once)
+
+strong_alias(close, __close)
+strong_alias(write, __write)
+strong_alias(read, __read)
+strong_alias(open, __open)
+strong_alias(sigaction, __sigaction)
+
+strong_alias(pthread_key_create, __pthread_key_create)
+strong_alias(pthread_getspecific, __pthread_getspecific)
+strong_alias(pthread_setspecific, __pthread_setspecific)
+strong_alias(open64, __open64)
+strong_alias(fcntl, __fcntl)
+strong_alias(connect, __connect)
+
+/*--------------------------------------------------*/
+
+/* I've no idea what these are, but they get called quite a lot.
+ Anybody know? */
+
+#undef _IO_flockfile
+void _IO_flockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_flockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_flockfile");
+}
+
+#undef _IO_funlockfile
+void _IO_funlockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_funlockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_funlockfile");
+}
+
+void _pthread_cleanup_push_defer ( void )
+{
+ // char* str = "_pthread_cleanup_push_defer\n";
+ // write(2, str, strlen(str));
+}
+
+void _pthread_cleanup_pop_restore ( void )
+{
+ // char* str = "_pthread_cleanup_pop_restore\n";
+ // write(2, str, strlen(str));
+}
--- /dev/null
+
+/* ---------------------------------------------------------------------
+ Give a binding for everything the real libpthread.so binds.
+ ------------------------------------------------------------------ */
+
+extern void vgPlain_unimp ( char* );
+#define unimp(str) vgPlain_unimp(str)
+
+//void _IO_flockfile ( void ) { unimp("_IO_flockfile"); }
+void _IO_ftrylockfile ( void ) { unimp("_IO_ftrylockfile"); }
+//void _IO_funlockfile ( void ) { unimp("_IO_funlockfile"); }
+//void __close ( void ) { unimp("__close"); }
+//void __connect ( void ) { unimp("__connect"); }
+//void __errno_location ( void ) { unimp("__errno_location"); }
+//void __fcntl ( void ) { unimp("__fcntl"); }
+void __fork ( void ) { unimp("__fork"); }
+//void __h_errno_location ( void ) { unimp("__h_errno_location"); }
+void __libc_allocate_rtsig ( void ) { unimp("__libc_allocate_rtsig"); }
+void __libc_current_sigrtmax ( void ) { unimp("__libc_current_sigrtmax"); }
+void __libc_current_sigrtmin ( void ) { unimp("__libc_current_sigrtmin"); }
+void __lseek ( void ) { unimp("__lseek"); }
+//void __open ( void ) { unimp("__open"); }
+//void __open64 ( void ) { unimp("__open64"); }
+void __pread64 ( void ) { unimp("__pread64"); }
+void __pthread_atfork ( void ) { unimp("__pthread_atfork"); }
+//void __pthread_getspecific ( void ) { unimp("__pthread_getspecific"); }
+//void __pthread_key_create ( void ) { unimp("__pthread_key_create"); }
+void __pthread_kill_other_threads_np ( void ) { unimp("__pthread_kill_other_threads_np"); }
+//void __pthread_mutex_destroy ( void ) { unimp("__pthread_mutex_destroy"); }
+//void __pthread_mutex_init ( void ) { unimp("__pthread_mutex_init"); }
+//void __pthread_mutex_lock ( void ) { unimp("__pthread_mutex_lock"); }
+void __pthread_mutex_trylock ( void ) { unimp("__pthread_mutex_trylock"); }
+//void __pthread_mutex_unlock ( void ) { unimp("__pthread_mutex_unlock"); }
+//void __pthread_mutexattr_destroy ( void ) { unimp("__pthread_mutexattr_destroy"); }
+//void __pthread_mutexattr_init ( void ) { unimp("__pthread_mutexattr_init"); }
+//void __pthread_mutexattr_settype ( void ) { unimp("__pthread_mutexattr_settype"); }
+//void __pthread_once ( void ) { unimp("__pthread_once"); }
+//void __pthread_setspecific ( void ) { unimp("__pthread_setspecific"); }
+void __pwrite64 ( void ) { unimp("__pwrite64"); }
+//void __read ( void ) { unimp("__read"); }
+//void __res_state ( void ) { unimp("__res_state"); }
+void __send ( void ) { unimp("__send"); }
+//void __sigaction ( void ) { unimp("__sigaction"); }
+void __vfork ( void ) { unimp("__vfork"); }
+void __wait ( void ) { unimp("__wait"); }
+//void __write ( void ) { unimp("__write"); }
+void _pthread_cleanup_pop ( void ) { unimp("_pthread_cleanup_pop"); }
+//void _pthread_cleanup_pop_restore ( void ) { unimp("_pthread_cleanup_pop_restore"); }
+void _pthread_cleanup_push ( void ) { unimp("_pthread_cleanup_push"); }
+//void _pthread_cleanup_push_defer ( void ) { unimp("_pthread_cleanup_push_defer"); }
+//void longjmp ( void ) { unimp("longjmp"); }
+void pthread_atfork ( void ) { unimp("pthread_atfork"); }
+//void pthread_attr_destroy ( void ) { unimp("pthread_attr_destroy"); }
+void pthread_attr_getdetachstate ( void ) { unimp("pthread_attr_getdetachstate"); }
+void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); }
+//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); }
+void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); }
+void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
+
+//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); }
+//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); }
+//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); }
+void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); }
+void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
+void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); }
+void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); }
+void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); }
+void pthread_barrierattr_destroy ( void ) { unimp("pthread_barrierattr_destroy"); }
+void pthread_barrierattr_init ( void ) { unimp("pthread_barrierattr_init"); }
+void pthread_barrierattr_setpshared ( void ) { unimp("pthread_barrierattr_setpshared"); }
+//void pthread_cancel ( void ) { unimp("pthread_cancel"); }
+//void pthread_cond_broadcast ( void ) { unimp("pthread_cond_broadcast"); }
+//void pthread_cond_destroy ( void ) { unimp("pthread_cond_destroy"); }
+//void pthread_cond_init ( void ) { unimp("pthread_cond_init"); }
+//void pthread_cond_signal ( void ) { unimp("pthread_cond_signal"); }
+//void pthread_cond_timedwait ( void ) { unimp("pthread_cond_timedwait"); }
+//void pthread_cond_wait ( void ) { unimp("pthread_cond_wait"); }
+//void pthread_condattr_destroy ( void ) { unimp("pthread_condattr_destroy"); }
+void pthread_condattr_getpshared ( void ) { unimp("pthread_condattr_getpshared"); }
+//void pthread_condattr_init ( void ) { unimp("pthread_condattr_init"); }
+void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared"); }
+void pthread_detach ( void ) { unimp("pthread_detach"); }
+//void pthread_equal ( void ) { unimp("pthread_equal"); }
+//void pthread_exit ( void ) { unimp("pthread_exit"); }
+void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); }
+void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); }
+//void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); }
+//void pthread_getspecific ( void ) { unimp("pthread_getspecific"); }
+//void pthread_join ( void ) { unimp("pthread_join"); }
+//void pthread_key_create ( void ) { unimp("pthread_key_create"); }
+//void pthread_key_delete ( void ) { unimp("pthread_key_delete"); }
+void pthread_kill ( void ) { unimp("pthread_kill"); }
+//void pthread_mutex_destroy ( void ) { unimp("pthread_mutex_destroy"); }
+//void pthread_mutex_init ( void ) { unimp("pthread_mutex_init"); }
+//void pthread_mutex_lock ( void ) { unimp("pthread_mutex_lock"); }
+void pthread_mutex_timedlock ( void ) { unimp("pthread_mutex_timedlock"); }
+//void pthread_mutex_trylock ( void ) { unimp("pthread_mutex_trylock"); }
+//void pthread_mutex_unlock ( void ) { unimp("pthread_mutex_unlock"); }
+//void pthread_mutexattr_destroy ( void ) { unimp("pthread_mutexattr_destroy"); }
+//void pthread_mutexattr_init ( void ) { unimp("pthread_mutexattr_init"); }
+//void pthread_once ( void ) { unimp("pthread_once"); }
+void pthread_rwlock_destroy ( void ) { unimp("pthread_rwlock_destroy"); }
+void pthread_rwlock_init ( void ) { unimp("pthread_rwlock_init"); }
+void pthread_rwlock_rdlock ( void ) { unimp("pthread_rwlock_rdlock"); }
+void pthread_rwlock_timedrdlock ( void ) { unimp("pthread_rwlock_timedrdlock"); }
+void pthread_rwlock_timedwrlock ( void ) { unimp("pthread_rwlock_timedwrlock"); }
+void pthread_rwlock_tryrdlock ( void ) { unimp("pthread_rwlock_tryrdlock"); }
+void pthread_rwlock_trywrlock ( void ) { unimp("pthread_rwlock_trywrlock"); }
+void pthread_rwlock_unlock ( void ) { unimp("pthread_rwlock_unlock"); }
+void pthread_rwlock_wrlock ( void ) { unimp("pthread_rwlock_wrlock"); }
+void pthread_rwlockattr_destroy ( void ) { unimp("pthread_rwlockattr_destroy"); }
+void pthread_rwlockattr_getkind_np ( void ) { unimp("pthread_rwlockattr_getkind_np"); }
+void pthread_rwlockattr_getpshared ( void ) { unimp("pthread_rwlockattr_getpshared"); }
+void pthread_rwlockattr_init ( void ) { unimp("pthread_rwlockattr_init"); }
+void pthread_rwlockattr_setkind_np ( void ) { unimp("pthread_rwlockattr_setkind_np"); }
+void pthread_rwlockattr_setpshared ( void ) { unimp("pthread_rwlockattr_setpshared"); }
+//void pthread_self ( void ) { unimp("pthread_self"); }
+void pthread_setcancelstate ( void ) { unimp("pthread_setcancelstate"); }
+//void pthread_setcanceltype ( void ) { unimp("pthread_setcanceltype"); }
+//void pthread_setschedparam ( void ) { unimp("pthread_setschedparam"); }
+//void pthread_setspecific ( void ) { unimp("pthread_setspecific"); }
+void pthread_sigmask ( void ) { unimp("pthread_sigmask"); }
+void pthread_testcancel ( void ) { unimp("pthread_testcancel"); }
+void raise ( void ) { unimp("raise"); }
+void sem_close ( void ) { unimp("sem_close"); }
+void sem_open ( void ) { unimp("sem_open"); }
+void sem_timedwait ( void ) { unimp("sem_timedwait"); }
+void sem_unlink ( void ) { unimp("sem_unlink"); }
+//void sigaction ( void ) { unimp("sigaction"); }
+void siglongjmp ( void ) { unimp("siglongjmp"); }
+void sigwait ( void ) { unimp("sigwait"); }
+
+#if 0
+void pthread_create@@GLIBC_2.1 ( void ) { unimp("pthread_create@@GLIBC_2.1"); }
+void pthread_create@GLIBC_2.0 ( void ) { unimp("pthread_create@GLIBC_2.0"); }
+
+void sem_wait@@GLIBC_2.1 ( void ) { unimp("sem_wait@@GLIBC_2.1"); }
+void sem_wait@GLIBC_2.0 ( void ) { unimp("sem_wait@GLIBC_2.0"); }
+
+void sem_trywait@@GLIBC_2.1 ( void ) { unimp("sem_trywait@@GLIBC_2.1"); }
+void sem_trywait@GLIBC_2.0 ( void ) { unimp("sem_trywait@GLIBC_2.0"); }
+
+void sem_post@@GLIBC_2.1 ( void ) { unimp("sem_post@@GLIBC_2.1"); }
+void sem_post@GLIBC_2.0 ( void ) { unimp("sem_post@GLIBC_2.0"); }
+
+void sem_destroy@@GLIBC_2.1 ( void ) { unimp("sem_destroy@@GLIBC_2.1"); }
+void sem_destroy@GLIBC_2.0 ( void ) { unimp("sem_destroy@GLIBC_2.0"); }
+void sem_getvalue@@GLIBC_2.1 ( void ) { unimp("sem_getvalue@@GLIBC_2.1"); }
+void sem_getvalue@GLIBC_2.0 ( void ) { unimp("sem_getvalue@GLIBC_2.0"); }
+void sem_init@@GLIBC_2.1 ( void ) { unimp("sem_init@@GLIBC_2.1"); }
+void sem_init@GLIBC_2.0 ( void ) { unimp("sem_init@GLIBC_2.0"); }
+
+void pthread_attr_init@@GLIBC_2.1 ( void ) { unimp("pthread_attr_init@@GLIBC_2.1"); }
+void pthread_attr_init@GLIBC_2.0 ( void ) { unimp("pthread_attr_init@GLIBC_2.0"); }
+#endif
/* Optional. We're not required to do this, although it shouldn't
make any difference to programs which use the key/specifics
functions correctly. */
+# if 1
for (tid = 1; tid < VG_N_THREADS; tid++) {
if (vg_threads[tid].status != VgTs_Empty)
vg_threads[tid].specifics[key] = NULL;
}
+# endif
}
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
val_PROGRAMS = valgrind.so valgrinq.so libpthread.so
-libpthread_so_SOURCES = vg_libpthread.c
+libpthread_so_SOURCES = vg_libpthread.c vg_libpthread_unimp.c
valgrinq_so_SOURCES = vg_valgrinq_dummy.c
}
}
+void vgPlain_unimp ( char* what )
+{
+ char* ig = "vg_libpthread.so: UNIMPLEMENTED FUNCTION: ";
+ write(2, ig, strlen(ig));
+ write(2, what, strlen(what));
+ ig = "\n";
+ write(2, ig, strlen(ig));
+ barf("Please report this bug to me at: jseward@acm.org");
+}
+
/* ---------------------------------------------------------------------
Pass pthread_ calls to Valgrind's request mechanism.
}
-static int thread_specific_errno[VG_N_THREADS];
-
-int* __errno_location ( void )
+pthread_t pthread_self(void)
{
int tid;
- /* ensure_valgrind("__errno_location"); */
+ ensure_valgrind("pthread_self");
VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
- /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("__errno_location: invalid ThreadId");
- return & thread_specific_errno[tid];
+ barf("pthread_self: invalid ThreadId");
+ return tid;
}
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
-#ifndef GLIBC_2_1
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
case PTHREAD_MUTEX_ADAPTIVE_NP:
-#endif
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
attr->__mutexkind = type;
/* ---------------------------------------------------
- MISC
+ LIBRARY-PRIVATE THREAD SPECIFIC STATE
------------------------------------------------ */
-/* What are these? Anybody know? I don't. */
+#include <resolv.h>
+static int thread_specific_errno[VG_N_THREADS];
+static int thread_specific_h_errno[VG_N_THREADS];
+static struct __res_state
+ thread_specific_res_state[VG_N_THREADS];
-void _pthread_cleanup_push_defer ( void )
+int* __errno_location ( void )
{
- // char* str = "_pthread_cleanup_push_defer\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__errno_location: invalid ThreadId");
+ return & thread_specific_errno[tid];
}
-void _pthread_cleanup_pop_restore ( void )
+int* __h_errno_location ( void )
{
- // char* str = "_pthread_cleanup_pop_restore\n";
- // write(2, str, strlen(str));
+ int tid;
+ /* ensure_valgrind("__h_errno_location"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
+ VG_USERREQ__PTHREAD_GET_THREADID,
+ 0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
+ if (tid < 0 || tid >= VG_N_THREADS)
+ barf("__h_errno_location: invalid ThreadId");
+ return & thread_specific_h_errno[tid];
}
-
-pthread_t pthread_self(void)
+struct __res_state* __res_state ( void )
{
int tid;
- ensure_valgrind("pthread_self");
- VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */,
+ /* ensure_valgrind("__res_state"); */
+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */,
VG_USERREQ__PTHREAD_GET_THREADID,
0, 0, 0, 0);
+ /* 'cos I'm paranoid ... */
if (tid < 0 || tid >= VG_N_THREADS)
- barf("pthread_self: invalid ThreadId");
- return tid;
+ barf("__res_state: invalid ThreadId");
+ return & thread_specific_res_state[tid];
}
}
-/*--------------------------------------------------*/
-
-/* I've no idea what these are, but they get called quite a lot.
- Anybody know? */
-
-#undef _IO_flockfile
-void _IO_flockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_flockfile\n";
- // write(2, str, strlen(str));
- // barf("_IO_flockfile");
-}
-
-#undef _IO_funlockfile
-void _IO_funlockfile ( _IO_FILE * file )
-{
- // char* str = "_IO_funlockfile\n";
- // write(2, str, strlen(str));
- //barf("_IO_funlockfile");
-}
+/* ---------------------------------------------------------------------
+ Nonblocking implementations of select() and poll(). This stuff will
+ surely rot your mind.
+ ------------------------------------------------------------------ */
/*--------------------------------------------------*/
(int)(&nanosleep_interval), (int)NULL);
}
}
+
+
+/* ---------------------------------------------------------------------
+ B'stard.
+ ------------------------------------------------------------------ */
+
+# define strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
+strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+strong_alias(pthread_mutexattr_init, __pthread_mutexattr_init)
+strong_alias(pthread_mutexattr_settype, __pthread_mutexattr_settype)
+strong_alias(pthread_mutex_init, __pthread_mutex_init)
+strong_alias(pthread_mutexattr_destroy, __pthread_mutexattr_destroy)
+strong_alias(pthread_mutex_destroy, __pthread_mutex_destroy)
+strong_alias(pthread_once, __pthread_once)
+
+strong_alias(close, __close)
+strong_alias(write, __write)
+strong_alias(read, __read)
+strong_alias(open, __open)
+strong_alias(sigaction, __sigaction)
+
+strong_alias(pthread_key_create, __pthread_key_create)
+strong_alias(pthread_getspecific, __pthread_getspecific)
+strong_alias(pthread_setspecific, __pthread_setspecific)
+strong_alias(open64, __open64)
+strong_alias(fcntl, __fcntl)
+strong_alias(connect, __connect)
+
+/*--------------------------------------------------*/
+
+/* I've no idea what these are, but they get called quite a lot.
+ Anybody know? */
+
+#undef _IO_flockfile
+void _IO_flockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_flockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_flockfile");
+}
+
+#undef _IO_funlockfile
+void _IO_funlockfile ( _IO_FILE * file )
+{
+ // char* str = "_IO_funlockfile\n";
+ // write(2, str, strlen(str));
+ // barf("_IO_funlockfile");
+}
+
+void _pthread_cleanup_push_defer ( void )
+{
+ // char* str = "_pthread_cleanup_push_defer\n";
+ // write(2, str, strlen(str));
+}
+
+void _pthread_cleanup_pop_restore ( void )
+{
+ // char* str = "_pthread_cleanup_pop_restore\n";
+ // write(2, str, strlen(str));
+}
--- /dev/null
+
+/* ---------------------------------------------------------------------
+ Give a binding for everything the real libpthread.so binds.
+ ------------------------------------------------------------------ */
+
+extern void vgPlain_unimp ( char* );
+#define unimp(str) vgPlain_unimp(str)
+
+//void _IO_flockfile ( void ) { unimp("_IO_flockfile"); }
+void _IO_ftrylockfile ( void ) { unimp("_IO_ftrylockfile"); }
+//void _IO_funlockfile ( void ) { unimp("_IO_funlockfile"); }
+//void __close ( void ) { unimp("__close"); }
+//void __connect ( void ) { unimp("__connect"); }
+//void __errno_location ( void ) { unimp("__errno_location"); }
+//void __fcntl ( void ) { unimp("__fcntl"); }
+void __fork ( void ) { unimp("__fork"); }
+//void __h_errno_location ( void ) { unimp("__h_errno_location"); }
+void __libc_allocate_rtsig ( void ) { unimp("__libc_allocate_rtsig"); }
+void __libc_current_sigrtmax ( void ) { unimp("__libc_current_sigrtmax"); }
+void __libc_current_sigrtmin ( void ) { unimp("__libc_current_sigrtmin"); }
+void __lseek ( void ) { unimp("__lseek"); }
+//void __open ( void ) { unimp("__open"); }
+//void __open64 ( void ) { unimp("__open64"); }
+void __pread64 ( void ) { unimp("__pread64"); }
+void __pthread_atfork ( void ) { unimp("__pthread_atfork"); }
+//void __pthread_getspecific ( void ) { unimp("__pthread_getspecific"); }
+//void __pthread_key_create ( void ) { unimp("__pthread_key_create"); }
+void __pthread_kill_other_threads_np ( void ) { unimp("__pthread_kill_other_threads_np"); }
+//void __pthread_mutex_destroy ( void ) { unimp("__pthread_mutex_destroy"); }
+//void __pthread_mutex_init ( void ) { unimp("__pthread_mutex_init"); }
+//void __pthread_mutex_lock ( void ) { unimp("__pthread_mutex_lock"); }
+void __pthread_mutex_trylock ( void ) { unimp("__pthread_mutex_trylock"); }
+//void __pthread_mutex_unlock ( void ) { unimp("__pthread_mutex_unlock"); }
+//void __pthread_mutexattr_destroy ( void ) { unimp("__pthread_mutexattr_destroy"); }
+//void __pthread_mutexattr_init ( void ) { unimp("__pthread_mutexattr_init"); }
+//void __pthread_mutexattr_settype ( void ) { unimp("__pthread_mutexattr_settype"); }
+//void __pthread_once ( void ) { unimp("__pthread_once"); }
+//void __pthread_setspecific ( void ) { unimp("__pthread_setspecific"); }
+void __pwrite64 ( void ) { unimp("__pwrite64"); }
+//void __read ( void ) { unimp("__read"); }
+//void __res_state ( void ) { unimp("__res_state"); }
+void __send ( void ) { unimp("__send"); }
+//void __sigaction ( void ) { unimp("__sigaction"); }
+void __vfork ( void ) { unimp("__vfork"); }
+void __wait ( void ) { unimp("__wait"); }
+//void __write ( void ) { unimp("__write"); }
+void _pthread_cleanup_pop ( void ) { unimp("_pthread_cleanup_pop"); }
+//void _pthread_cleanup_pop_restore ( void ) { unimp("_pthread_cleanup_pop_restore"); }
+void _pthread_cleanup_push ( void ) { unimp("_pthread_cleanup_push"); }
+//void _pthread_cleanup_push_defer ( void ) { unimp("_pthread_cleanup_push_defer"); }
+//void longjmp ( void ) { unimp("longjmp"); }
+void pthread_atfork ( void ) { unimp("pthread_atfork"); }
+//void pthread_attr_destroy ( void ) { unimp("pthread_attr_destroy"); }
+void pthread_attr_getdetachstate ( void ) { unimp("pthread_attr_getdetachstate"); }
+void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); }
+//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); }
+void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); }
+void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
+
+//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); }
+//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); }
+//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); }
+void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); }
+void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
+void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); }
+void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); }
+void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); }
+void pthread_barrierattr_destroy ( void ) { unimp("pthread_barrierattr_destroy"); }
+void pthread_barrierattr_init ( void ) { unimp("pthread_barrierattr_init"); }
+void pthread_barrierattr_setpshared ( void ) { unimp("pthread_barrierattr_setpshared"); }
+//void pthread_cancel ( void ) { unimp("pthread_cancel"); }
+//void pthread_cond_broadcast ( void ) { unimp("pthread_cond_broadcast"); }
+//void pthread_cond_destroy ( void ) { unimp("pthread_cond_destroy"); }
+//void pthread_cond_init ( void ) { unimp("pthread_cond_init"); }
+//void pthread_cond_signal ( void ) { unimp("pthread_cond_signal"); }
+//void pthread_cond_timedwait ( void ) { unimp("pthread_cond_timedwait"); }
+//void pthread_cond_wait ( void ) { unimp("pthread_cond_wait"); }
+//void pthread_condattr_destroy ( void ) { unimp("pthread_condattr_destroy"); }
+void pthread_condattr_getpshared ( void ) { unimp("pthread_condattr_getpshared"); }
+//void pthread_condattr_init ( void ) { unimp("pthread_condattr_init"); }
+void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared"); }
+void pthread_detach ( void ) { unimp("pthread_detach"); }
+//void pthread_equal ( void ) { unimp("pthread_equal"); }
+//void pthread_exit ( void ) { unimp("pthread_exit"); }
+void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); }
+void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); }
+//void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); }
+//void pthread_getspecific ( void ) { unimp("pthread_getspecific"); }
+//void pthread_join ( void ) { unimp("pthread_join"); }
+//void pthread_key_create ( void ) { unimp("pthread_key_create"); }
+//void pthread_key_delete ( void ) { unimp("pthread_key_delete"); }
+void pthread_kill ( void ) { unimp("pthread_kill"); }
+//void pthread_mutex_destroy ( void ) { unimp("pthread_mutex_destroy"); }
+//void pthread_mutex_init ( void ) { unimp("pthread_mutex_init"); }
+//void pthread_mutex_lock ( void ) { unimp("pthread_mutex_lock"); }
+void pthread_mutex_timedlock ( void ) { unimp("pthread_mutex_timedlock"); }
+//void pthread_mutex_trylock ( void ) { unimp("pthread_mutex_trylock"); }
+//void pthread_mutex_unlock ( void ) { unimp("pthread_mutex_unlock"); }
+//void pthread_mutexattr_destroy ( void ) { unimp("pthread_mutexattr_destroy"); }
+//void pthread_mutexattr_init ( void ) { unimp("pthread_mutexattr_init"); }
+//void pthread_once ( void ) { unimp("pthread_once"); }
+void pthread_rwlock_destroy ( void ) { unimp("pthread_rwlock_destroy"); }
+void pthread_rwlock_init ( void ) { unimp("pthread_rwlock_init"); }
+void pthread_rwlock_rdlock ( void ) { unimp("pthread_rwlock_rdlock"); }
+void pthread_rwlock_timedrdlock ( void ) { unimp("pthread_rwlock_timedrdlock"); }
+void pthread_rwlock_timedwrlock ( void ) { unimp("pthread_rwlock_timedwrlock"); }
+void pthread_rwlock_tryrdlock ( void ) { unimp("pthread_rwlock_tryrdlock"); }
+void pthread_rwlock_trywrlock ( void ) { unimp("pthread_rwlock_trywrlock"); }
+void pthread_rwlock_unlock ( void ) { unimp("pthread_rwlock_unlock"); }
+void pthread_rwlock_wrlock ( void ) { unimp("pthread_rwlock_wrlock"); }
+void pthread_rwlockattr_destroy ( void ) { unimp("pthread_rwlockattr_destroy"); }
+void pthread_rwlockattr_getkind_np ( void ) { unimp("pthread_rwlockattr_getkind_np"); }
+void pthread_rwlockattr_getpshared ( void ) { unimp("pthread_rwlockattr_getpshared"); }
+void pthread_rwlockattr_init ( void ) { unimp("pthread_rwlockattr_init"); }
+void pthread_rwlockattr_setkind_np ( void ) { unimp("pthread_rwlockattr_setkind_np"); }
+void pthread_rwlockattr_setpshared ( void ) { unimp("pthread_rwlockattr_setpshared"); }
+//void pthread_self ( void ) { unimp("pthread_self"); }
+void pthread_setcancelstate ( void ) { unimp("pthread_setcancelstate"); }
+//void pthread_setcanceltype ( void ) { unimp("pthread_setcanceltype"); }
+//void pthread_setschedparam ( void ) { unimp("pthread_setschedparam"); }
+//void pthread_setspecific ( void ) { unimp("pthread_setspecific"); }
+void pthread_sigmask ( void ) { unimp("pthread_sigmask"); }
+void pthread_testcancel ( void ) { unimp("pthread_testcancel"); }
+void raise ( void ) { unimp("raise"); }
+void sem_close ( void ) { unimp("sem_close"); }
+void sem_open ( void ) { unimp("sem_open"); }
+void sem_timedwait ( void ) { unimp("sem_timedwait"); }
+void sem_unlink ( void ) { unimp("sem_unlink"); }
+//void sigaction ( void ) { unimp("sigaction"); }
+void siglongjmp ( void ) { unimp("siglongjmp"); }
+void sigwait ( void ) { unimp("sigwait"); }
+
+#if 0
+void pthread_create@@GLIBC_2.1 ( void ) { unimp("pthread_create@@GLIBC_2.1"); }
+void pthread_create@GLIBC_2.0 ( void ) { unimp("pthread_create@GLIBC_2.0"); }
+
+void sem_wait@@GLIBC_2.1 ( void ) { unimp("sem_wait@@GLIBC_2.1"); }
+void sem_wait@GLIBC_2.0 ( void ) { unimp("sem_wait@GLIBC_2.0"); }
+
+void sem_trywait@@GLIBC_2.1 ( void ) { unimp("sem_trywait@@GLIBC_2.1"); }
+void sem_trywait@GLIBC_2.0 ( void ) { unimp("sem_trywait@GLIBC_2.0"); }
+
+void sem_post@@GLIBC_2.1 ( void ) { unimp("sem_post@@GLIBC_2.1"); }
+void sem_post@GLIBC_2.0 ( void ) { unimp("sem_post@GLIBC_2.0"); }
+
+void sem_destroy@@GLIBC_2.1 ( void ) { unimp("sem_destroy@@GLIBC_2.1"); }
+void sem_destroy@GLIBC_2.0 ( void ) { unimp("sem_destroy@GLIBC_2.0"); }
+void sem_getvalue@@GLIBC_2.1 ( void ) { unimp("sem_getvalue@@GLIBC_2.1"); }
+void sem_getvalue@GLIBC_2.0 ( void ) { unimp("sem_getvalue@GLIBC_2.0"); }
+void sem_init@@GLIBC_2.1 ( void ) { unimp("sem_init@@GLIBC_2.1"); }
+void sem_init@GLIBC_2.0 ( void ) { unimp("sem_init@GLIBC_2.0"); }
+
+void pthread_attr_init@@GLIBC_2.1 ( void ) { unimp("pthread_attr_init@@GLIBC_2.1"); }
+void pthread_attr_init@GLIBC_2.0 ( void ) { unimp("pthread_attr_init@GLIBC_2.0"); }
+#endif
/* Optional. We're not required to do this, although it shouldn't
make any difference to programs which use the key/specifics
functions correctly. */
+# if 1
for (tid = 1; tid < VG_N_THREADS; tid++) {
if (vg_threads[tid].status != VgTs_Empty)
vg_threads[tid].specifics[key] = NULL;
}
+# endif
}