Finish first pass of the symbols cleanup. Only versioned symbols remain
to do.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@155 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c
index dfb02af..0ed95d0 100644
--- a/coregrind/arch/x86-linux/vg_libpthread.c
+++ b/coregrind/arch/x86-linux/vg_libpthread.c
@@ -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 @@
}
-
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@
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 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 @@
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_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_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 @@
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_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_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_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_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 *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 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_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 @@
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_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 @@
void (*parent)(void),
void (*child)(void) )
{
- ignored("pthread_atfork");
+ static int moans = N_MOANS;
+ if (moans-- > 0)
+ ignored("pthread_atfork");
return 0;
}
@@ -948,6 +978,17 @@
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);
__attribute__((weak))
@@ -1336,7 +1377,9 @@
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 @@
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;
}
diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
index 421c708..2b9aa63 100644
--- a/coregrind/arch/x86-linux/vg_libpthread_unimp.c
+++ b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
@@ -173,6 +173,7 @@
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 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"); }
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index dfb02af..0ed95d0 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -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 @@
}
-
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@
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 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 @@
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_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_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 @@
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_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_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_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_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 *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 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_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 @@
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_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 @@
void (*parent)(void),
void (*child)(void) )
{
- ignored("pthread_atfork");
+ static int moans = N_MOANS;
+ if (moans-- > 0)
+ ignored("pthread_atfork");
return 0;
}
@@ -948,6 +978,17 @@
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);
__attribute__((weak))
@@ -1336,7 +1377,9 @@
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 @@
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;
}
diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c
index 421c708..2b9aa63 100644
--- a/coregrind/vg_libpthread_unimp.c
+++ b/coregrind/vg_libpthread_unimp.c
@@ -173,6 +173,7 @@
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 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"); }
diff --git a/vg_libpthread.c b/vg_libpthread.c
index dfb02af..0ed95d0 100644
--- a/vg_libpthread.c
+++ b/vg_libpthread.c
@@ -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 @@
}
-
static
void myexit ( int arg )
{
@@ -106,7 +108,7 @@
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 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 @@
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_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_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 @@
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_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_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_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_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 *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 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_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 @@
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_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 @@
void (*parent)(void),
void (*child)(void) )
{
- ignored("pthread_atfork");
+ static int moans = N_MOANS;
+ if (moans-- > 0)
+ ignored("pthread_atfork");
return 0;
}
@@ -948,6 +978,17 @@
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);
__attribute__((weak))
@@ -1336,7 +1377,9 @@
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 @@
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;
}
diff --git a/vg_libpthread_unimp.c b/vg_libpthread_unimp.c
index 421c708..2b9aa63 100644
--- a/vg_libpthread_unimp.c
+++ b/vg_libpthread_unimp.c
@@ -173,6 +173,7 @@
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 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"); }