Finish first pass of the symbols cleanup. Only versioned symbols remain

to do.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@155
This commit is contained in:
Julian Seward
2002-04-26 14:31:40 +00:00
parent c81d619159
commit 205ec6efd2
6 changed files with 351 additions and 69 deletions

View File

@@ -33,6 +33,9 @@
Helpers. We have to be pretty self-sufficient.
------------------------------------------------------------------ */
/* Number of times any given error message is printed. */
#define N_MOANS 3
/* Extract from Valgrind the value of VG_(clo_trace_pthread_level).
Returns 0 (none) if not running on Valgrind. */
static
@@ -46,7 +49,6 @@ int get_pt_trace_level ( void )
}
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@ void barf ( char* str )
static void ignored ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: IGNORED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -117,7 +119,7 @@ static void ignored ( char* msg )
static void kludged ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: KLUDGED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -153,19 +155,25 @@ void vgPlain_unimp ( char* what )
int pthread_attr_init(pthread_attr_t *attr)
{
ignored("pthread_attr_init");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_init");
return 0;
}
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
ignored("pthread_attr_setdetachstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setdetachstate");
return 0;
}
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
ignored("pthread_attr_setinheritsched");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setinheritsched");
return 0;
}
@@ -173,7 +181,9 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
{
kludged("pthread_attr_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_attr_getschedparam");
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
# else
@@ -185,13 +195,17 @@ int pthread_attr_getschedparam(const pthread_attr_t *attr,
int pthread_attr_setschedparam(pthread_attr_t *attr,
const struct sched_param *param)
{
ignored("pthread_attr_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setschedparam");
return 0;
}
int pthread_attr_destroy(pthread_attr_t *attr)
{
ignored("pthread_attr_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_destroy");
return 0;
}
@@ -261,7 +275,9 @@ pthread_t pthread_self(void)
int pthread_detach(pthread_t th)
{
ignored("pthread_detach");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_detach");
return 0;
}
@@ -316,7 +332,7 @@ int __pthread_mutex_init(pthread_mutex_t *mutex,
int __pthread_mutex_lock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_lock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -332,7 +348,7 @@ int __pthread_mutex_lock(pthread_mutex_t *mutex)
int __pthread_mutex_trylock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_trylock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -348,7 +364,7 @@ int __pthread_mutex_trylock(pthread_mutex_t *mutex)
int __pthread_mutex_unlock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_unlock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -400,7 +416,9 @@ int pthread_cond_init( pthread_cond_t *cond,
int pthread_cond_destroy(pthread_cond_t *cond)
{
/* should check that no threads are waiting on this CV */
kludged("pthread_cond_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_cond_destroy");
return 0;
}
@@ -413,7 +431,9 @@ int pthread_getschedparam(pthread_t target_thread,
int *policy,
struct sched_param *param)
{
kludged("pthread_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
@@ -427,7 +447,9 @@ int pthread_setschedparam(pthread_t target_thread,
int policy,
const struct sched_param *param)
{
ignored("pthread_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setschedparam");
return 0;
}
@@ -502,13 +524,17 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
int pthread_setcancelstate(int state, int *oldstate)
{
ignored("pthread_setcancelstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcancelstate");
return 0;
}
int pthread_setcanceltype(int type, int *oldtype)
{
ignored("pthread_setcanceltype");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcanceltype");
return 0;
}
@@ -537,7 +563,7 @@ void __pthread_kill_other_threads_np ( void )
for (i = 1; i < VG_N_THREADS; i++) {
if (i == me) continue;
res = pthread_cancel(i);
if (res == 0)
if (0 && res == 0)
printf("----------- NUKED %d\n", i);
}
pthread_mutex_unlock(&massacre_mx);
@@ -561,7 +587,9 @@ int __pthread_key_create(pthread_key_t *key,
int pthread_key_delete(pthread_key_t key)
{
ignored("pthread_key_delete");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_key_delete");
return 0;
}
@@ -624,7 +652,9 @@ int __pthread_atfork ( void (*prepare)(void),
void (*parent)(void),
void (*child)(void) )
{
ignored("pthread_atfork");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_atfork");
return 0;
}
@@ -947,6 +977,17 @@ int recv(int s, void *buf, size_t len, int flags)
}
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
__attribute__((weak))
int recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
{
return __libc_recvfrom(s, buf, len, flags, from, fromlen);
}
extern
int __libc_sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen);
@@ -1336,7 +1377,9 @@ weak_alias(__fork, fork)
int
pthread_rwlock_rdlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_rdlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_rdlock");
return 0;
}
@@ -1346,7 +1389,9 @@ weak_alias(pthread_rwlock_rdlock, __pthread_rwlock_rdlock)
int
pthread_rwlock_unlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_unlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_unlock");
return 0;
}

View File

@@ -173,6 +173,7 @@ weak_alias(pthread_rwlock_wrlock, __pthread_rwlock_wrlock)
weak_alias(_IO_ftrylockfile, ftrylockfile)
__attribute__((weak)) void pread ( void ) { vgPlain_unimp("pread"); }
__attribute__((weak)) void pwrite ( void ) { vgPlain_unimp("pwrite"); }
__attribute__((weak)) void msync ( void ) { vgPlain_unimp("msync"); }
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
@@ -180,3 +181,51 @@ __attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
__attribute__((weak)) void pthread_attr_getguardsize ( void )
{ vgPlain_unimp("pthread_attr_getguardsize"); }
__attribute__((weak)) void pthread_attr_getstack ( void )
{ vgPlain_unimp("pthread_attr_getstack"); }
__attribute__((weak)) void pthread_attr_getstackaddr ( void )
{ vgPlain_unimp("pthread_attr_getstackaddr"); }
__attribute__((weak)) void pthread_attr_getstacksize ( void )
{ vgPlain_unimp("pthread_attr_getstacksize"); }
__attribute__((weak)) void pthread_attr_setguardsize ( void )
{ vgPlain_unimp("pthread_attr_setguardsize"); }
__attribute__((weak)) void pthread_attr_setstack ( void )
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
__attribute__((weak)) void pthread_attr_setstacksize ( void )
{ vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )
{ vgPlain_unimp("pthread_kill_other_threads_np"); }
__attribute__((weak)) void pthread_mutexattr_getkind_np ( void )
{ vgPlain_unimp("pthread_mutexattr_getkind_np"); }
__attribute__((weak)) void pthread_mutexattr_getpshared ( void )
{ vgPlain_unimp("pthread_mutexattr_getpshared"); }
__attribute__((weak)) void pthread_mutexattr_gettype ( void )
{ 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_setconcurrency ( void )
{ vgPlain_unimp("pthread_setconcurrency"); }
__attribute__((weak)) void pthread_spin_destroy ( void )
{ vgPlain_unimp("pthread_spin_destroy"); }
__attribute__((weak)) void pthread_spin_init ( void )
{ vgPlain_unimp("pthread_spin_init"); }
__attribute__((weak)) void pthread_spin_lock ( void )
{ vgPlain_unimp("pthread_spin_lock"); }
__attribute__((weak)) void pthread_spin_trylock ( void )
{ vgPlain_unimp("pthread_spin_trylock"); }
__attribute__((weak)) void pthread_spin_unlock ( void )
{ vgPlain_unimp("pthread_spin_unlock"); }
__attribute__((weak)) void pthread_yield ( void )
{ vgPlain_unimp("pthread_yield"); }
__attribute__((weak)) void __pthread_initialize ( void )
{ vgPlain_unimp("__pthread_initialize"); }

View File

@@ -33,6 +33,9 @@
Helpers. We have to be pretty self-sufficient.
------------------------------------------------------------------ */
/* Number of times any given error message is printed. */
#define N_MOANS 3
/* Extract from Valgrind the value of VG_(clo_trace_pthread_level).
Returns 0 (none) if not running on Valgrind. */
static
@@ -46,7 +49,6 @@ int get_pt_trace_level ( void )
}
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@ void barf ( char* str )
static void ignored ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: IGNORED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -117,7 +119,7 @@ static void ignored ( char* msg )
static void kludged ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: KLUDGED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -153,19 +155,25 @@ void vgPlain_unimp ( char* what )
int pthread_attr_init(pthread_attr_t *attr)
{
ignored("pthread_attr_init");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_init");
return 0;
}
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
ignored("pthread_attr_setdetachstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setdetachstate");
return 0;
}
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
ignored("pthread_attr_setinheritsched");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setinheritsched");
return 0;
}
@@ -173,7 +181,9 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
{
kludged("pthread_attr_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_attr_getschedparam");
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
# else
@@ -185,13 +195,17 @@ int pthread_attr_getschedparam(const pthread_attr_t *attr,
int pthread_attr_setschedparam(pthread_attr_t *attr,
const struct sched_param *param)
{
ignored("pthread_attr_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setschedparam");
return 0;
}
int pthread_attr_destroy(pthread_attr_t *attr)
{
ignored("pthread_attr_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_destroy");
return 0;
}
@@ -261,7 +275,9 @@ pthread_t pthread_self(void)
int pthread_detach(pthread_t th)
{
ignored("pthread_detach");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_detach");
return 0;
}
@@ -316,7 +332,7 @@ int __pthread_mutex_init(pthread_mutex_t *mutex,
int __pthread_mutex_lock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_lock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -332,7 +348,7 @@ int __pthread_mutex_lock(pthread_mutex_t *mutex)
int __pthread_mutex_trylock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_trylock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -348,7 +364,7 @@ int __pthread_mutex_trylock(pthread_mutex_t *mutex)
int __pthread_mutex_unlock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_unlock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -400,7 +416,9 @@ int pthread_cond_init( pthread_cond_t *cond,
int pthread_cond_destroy(pthread_cond_t *cond)
{
/* should check that no threads are waiting on this CV */
kludged("pthread_cond_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_cond_destroy");
return 0;
}
@@ -413,7 +431,9 @@ int pthread_getschedparam(pthread_t target_thread,
int *policy,
struct sched_param *param)
{
kludged("pthread_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
@@ -427,7 +447,9 @@ int pthread_setschedparam(pthread_t target_thread,
int policy,
const struct sched_param *param)
{
ignored("pthread_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setschedparam");
return 0;
}
@@ -502,13 +524,17 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
int pthread_setcancelstate(int state, int *oldstate)
{
ignored("pthread_setcancelstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcancelstate");
return 0;
}
int pthread_setcanceltype(int type, int *oldtype)
{
ignored("pthread_setcanceltype");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcanceltype");
return 0;
}
@@ -537,7 +563,7 @@ void __pthread_kill_other_threads_np ( void )
for (i = 1; i < VG_N_THREADS; i++) {
if (i == me) continue;
res = pthread_cancel(i);
if (res == 0)
if (0 && res == 0)
printf("----------- NUKED %d\n", i);
}
pthread_mutex_unlock(&massacre_mx);
@@ -561,7 +587,9 @@ int __pthread_key_create(pthread_key_t *key,
int pthread_key_delete(pthread_key_t key)
{
ignored("pthread_key_delete");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_key_delete");
return 0;
}
@@ -624,7 +652,9 @@ int __pthread_atfork ( void (*prepare)(void),
void (*parent)(void),
void (*child)(void) )
{
ignored("pthread_atfork");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_atfork");
return 0;
}
@@ -947,6 +977,17 @@ int recv(int s, void *buf, size_t len, int flags)
}
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
__attribute__((weak))
int recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
{
return __libc_recvfrom(s, buf, len, flags, from, fromlen);
}
extern
int __libc_sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen);
@@ -1336,7 +1377,9 @@ weak_alias(__fork, fork)
int
pthread_rwlock_rdlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_rdlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_rdlock");
return 0;
}
@@ -1346,7 +1389,9 @@ weak_alias(pthread_rwlock_rdlock, __pthread_rwlock_rdlock)
int
pthread_rwlock_unlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_unlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_unlock");
return 0;
}

View File

@@ -173,6 +173,7 @@ weak_alias(pthread_rwlock_wrlock, __pthread_rwlock_wrlock)
weak_alias(_IO_ftrylockfile, ftrylockfile)
__attribute__((weak)) void pread ( void ) { vgPlain_unimp("pread"); }
__attribute__((weak)) void pwrite ( void ) { vgPlain_unimp("pwrite"); }
__attribute__((weak)) void msync ( void ) { vgPlain_unimp("msync"); }
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
@@ -180,3 +181,51 @@ __attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
__attribute__((weak)) void pthread_attr_getguardsize ( void )
{ vgPlain_unimp("pthread_attr_getguardsize"); }
__attribute__((weak)) void pthread_attr_getstack ( void )
{ vgPlain_unimp("pthread_attr_getstack"); }
__attribute__((weak)) void pthread_attr_getstackaddr ( void )
{ vgPlain_unimp("pthread_attr_getstackaddr"); }
__attribute__((weak)) void pthread_attr_getstacksize ( void )
{ vgPlain_unimp("pthread_attr_getstacksize"); }
__attribute__((weak)) void pthread_attr_setguardsize ( void )
{ vgPlain_unimp("pthread_attr_setguardsize"); }
__attribute__((weak)) void pthread_attr_setstack ( void )
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
__attribute__((weak)) void pthread_attr_setstacksize ( void )
{ vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )
{ vgPlain_unimp("pthread_kill_other_threads_np"); }
__attribute__((weak)) void pthread_mutexattr_getkind_np ( void )
{ vgPlain_unimp("pthread_mutexattr_getkind_np"); }
__attribute__((weak)) void pthread_mutexattr_getpshared ( void )
{ vgPlain_unimp("pthread_mutexattr_getpshared"); }
__attribute__((weak)) void pthread_mutexattr_gettype ( void )
{ 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_setconcurrency ( void )
{ vgPlain_unimp("pthread_setconcurrency"); }
__attribute__((weak)) void pthread_spin_destroy ( void )
{ vgPlain_unimp("pthread_spin_destroy"); }
__attribute__((weak)) void pthread_spin_init ( void )
{ vgPlain_unimp("pthread_spin_init"); }
__attribute__((weak)) void pthread_spin_lock ( void )
{ vgPlain_unimp("pthread_spin_lock"); }
__attribute__((weak)) void pthread_spin_trylock ( void )
{ vgPlain_unimp("pthread_spin_trylock"); }
__attribute__((weak)) void pthread_spin_unlock ( void )
{ vgPlain_unimp("pthread_spin_unlock"); }
__attribute__((weak)) void pthread_yield ( void )
{ vgPlain_unimp("pthread_yield"); }
__attribute__((weak)) void __pthread_initialize ( void )
{ vgPlain_unimp("__pthread_initialize"); }

View File

@@ -33,6 +33,9 @@
Helpers. We have to be pretty self-sufficient.
------------------------------------------------------------------ */
/* Number of times any given error message is printed. */
#define N_MOANS 3
/* Extract from Valgrind the value of VG_(clo_trace_pthread_level).
Returns 0 (none) if not running on Valgrind. */
static
@@ -46,7 +49,6 @@ int get_pt_trace_level ( void )
}
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@ void barf ( char* str )
static void ignored ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: IGNORED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -117,7 +119,7 @@ static void ignored ( char* msg )
static void kludged ( char* msg )
{
if (get_pt_trace_level() >= 1) {
if (get_pt_trace_level() >= 0) {
char* ig = "vg_libpthread.so: KLUDGED call to: ";
write(2, ig, strlen(ig));
write(2, msg, strlen(msg));
@@ -153,19 +155,25 @@ void vgPlain_unimp ( char* what )
int pthread_attr_init(pthread_attr_t *attr)
{
ignored("pthread_attr_init");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_init");
return 0;
}
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
ignored("pthread_attr_setdetachstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setdetachstate");
return 0;
}
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
ignored("pthread_attr_setinheritsched");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setinheritsched");
return 0;
}
@@ -173,7 +181,9 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
{
kludged("pthread_attr_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_attr_getschedparam");
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
# else
@@ -185,13 +195,17 @@ int pthread_attr_getschedparam(const pthread_attr_t *attr,
int pthread_attr_setschedparam(pthread_attr_t *attr,
const struct sched_param *param)
{
ignored("pthread_attr_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_setschedparam");
return 0;
}
int pthread_attr_destroy(pthread_attr_t *attr)
{
ignored("pthread_attr_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_attr_destroy");
return 0;
}
@@ -261,7 +275,9 @@ pthread_t pthread_self(void)
int pthread_detach(pthread_t th)
{
ignored("pthread_detach");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_detach");
return 0;
}
@@ -316,7 +332,7 @@ int __pthread_mutex_init(pthread_mutex_t *mutex,
int __pthread_mutex_lock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_lock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -332,7 +348,7 @@ int __pthread_mutex_lock(pthread_mutex_t *mutex)
int __pthread_mutex_trylock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_trylock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -348,7 +364,7 @@ int __pthread_mutex_trylock(pthread_mutex_t *mutex)
int __pthread_mutex_unlock(pthread_mutex_t *mutex)
{
int res;
static int moans = 3;
static int moans = N_MOANS;
if (!(RUNNING_ON_VALGRIND) && moans-- > 0) {
char* str = "pthread_mutex_unlock-NOT-INSIDE-VALGRIND\n";
write(2, str, strlen(str));
@@ -400,7 +416,9 @@ int pthread_cond_init( pthread_cond_t *cond,
int pthread_cond_destroy(pthread_cond_t *cond)
{
/* should check that no threads are waiting on this CV */
kludged("pthread_cond_destroy");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_cond_destroy");
return 0;
}
@@ -413,7 +431,9 @@ int pthread_getschedparam(pthread_t target_thread,
int *policy,
struct sched_param *param)
{
kludged("pthread_getschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
# ifdef GLIBC_2_1
if (param) param->sched_priority = 0; /* who knows */
@@ -427,7 +447,9 @@ int pthread_setschedparam(pthread_t target_thread,
int policy,
const struct sched_param *param)
{
ignored("pthread_setschedparam");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setschedparam");
return 0;
}
@@ -502,13 +524,17 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
int pthread_setcancelstate(int state, int *oldstate)
{
ignored("pthread_setcancelstate");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcancelstate");
return 0;
}
int pthread_setcanceltype(int type, int *oldtype)
{
ignored("pthread_setcanceltype");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_setcanceltype");
return 0;
}
@@ -537,7 +563,7 @@ void __pthread_kill_other_threads_np ( void )
for (i = 1; i < VG_N_THREADS; i++) {
if (i == me) continue;
res = pthread_cancel(i);
if (res == 0)
if (0 && res == 0)
printf("----------- NUKED %d\n", i);
}
pthread_mutex_unlock(&massacre_mx);
@@ -561,7 +587,9 @@ int __pthread_key_create(pthread_key_t *key,
int pthread_key_delete(pthread_key_t key)
{
ignored("pthread_key_delete");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_key_delete");
return 0;
}
@@ -624,7 +652,9 @@ int __pthread_atfork ( void (*prepare)(void),
void (*parent)(void),
void (*child)(void) )
{
ignored("pthread_atfork");
static int moans = N_MOANS;
if (moans-- > 0)
ignored("pthread_atfork");
return 0;
}
@@ -947,6 +977,17 @@ int recv(int s, void *buf, size_t len, int flags)
}
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
__attribute__((weak))
int recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
{
return __libc_recvfrom(s, buf, len, flags, from, fromlen);
}
extern
int __libc_sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen);
@@ -1336,7 +1377,9 @@ weak_alias(__fork, fork)
int
pthread_rwlock_rdlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_rdlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_rdlock");
return 0;
}
@@ -1346,7 +1389,9 @@ weak_alias(pthread_rwlock_rdlock, __pthread_rwlock_rdlock)
int
pthread_rwlock_unlock (void* /* pthread_rwlock_t* */ rwlock)
{
kludged("pthread_rwlock_unlock");
static int moans = N_MOANS;
if (moans-- > 0)
kludged("pthread_rwlock_unlock");
return 0;
}

View File

@@ -173,6 +173,7 @@ weak_alias(pthread_rwlock_wrlock, __pthread_rwlock_wrlock)
weak_alias(_IO_ftrylockfile, ftrylockfile)
__attribute__((weak)) void pread ( void ) { vgPlain_unimp("pread"); }
__attribute__((weak)) void pwrite ( void ) { vgPlain_unimp("pwrite"); }
__attribute__((weak)) void msync ( void ) { vgPlain_unimp("msync"); }
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
@@ -180,3 +181,51 @@ __attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
__attribute__((weak)) void pthread_attr_getguardsize ( void )
{ vgPlain_unimp("pthread_attr_getguardsize"); }
__attribute__((weak)) void pthread_attr_getstack ( void )
{ vgPlain_unimp("pthread_attr_getstack"); }
__attribute__((weak)) void pthread_attr_getstackaddr ( void )
{ vgPlain_unimp("pthread_attr_getstackaddr"); }
__attribute__((weak)) void pthread_attr_getstacksize ( void )
{ vgPlain_unimp("pthread_attr_getstacksize"); }
__attribute__((weak)) void pthread_attr_setguardsize ( void )
{ vgPlain_unimp("pthread_attr_setguardsize"); }
__attribute__((weak)) void pthread_attr_setstack ( void )
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
__attribute__((weak)) void pthread_attr_setstacksize ( void )
{ vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )
{ vgPlain_unimp("pthread_kill_other_threads_np"); }
__attribute__((weak)) void pthread_mutexattr_getkind_np ( void )
{ vgPlain_unimp("pthread_mutexattr_getkind_np"); }
__attribute__((weak)) void pthread_mutexattr_getpshared ( void )
{ vgPlain_unimp("pthread_mutexattr_getpshared"); }
__attribute__((weak)) void pthread_mutexattr_gettype ( void )
{ 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_setconcurrency ( void )
{ vgPlain_unimp("pthread_setconcurrency"); }
__attribute__((weak)) void pthread_spin_destroy ( void )
{ vgPlain_unimp("pthread_spin_destroy"); }
__attribute__((weak)) void pthread_spin_init ( void )
{ vgPlain_unimp("pthread_spin_init"); }
__attribute__((weak)) void pthread_spin_lock ( void )
{ vgPlain_unimp("pthread_spin_lock"); }
__attribute__((weak)) void pthread_spin_trylock ( void )
{ vgPlain_unimp("pthread_spin_trylock"); }
__attribute__((weak)) void pthread_spin_unlock ( void )
{ vgPlain_unimp("pthread_spin_unlock"); }
__attribute__((weak)) void pthread_yield ( void )
{ vgPlain_unimp("pthread_yield"); }
__attribute__((weak)) void __pthread_initialize ( void )
{ vgPlain_unimp("__pthread_initialize"); }