Cancellation wrapper for sendmsg(), wierd wrapper for raise().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@278 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c
index ba6b527..e0f4806 100644
--- a/coregrind/arch/x86-linux/vg_libpthread.c
+++ b/coregrind/arch/x86-linux/vg_libpthread.c
@@ -683,6 +683,21 @@
}
+/* Copied verbatim from Linuxthreads */
+/* Redefine raise() to send signal to calling thread only,
+ as per POSIX 1003.1c */
+int raise (int sig)
+{
+ int retcode = pthread_kill(pthread_self(), sig);
+ if (retcode == 0)
+ return 0;
+ else {
+ errno = retcode;
+ return -1;
+ }
+}
+
+
/* ---------------------------------------------------
THREAD-SPECIFICs
------------------------------------------------ */
@@ -1123,6 +1138,15 @@
}
+extern
+int __libc_sendmsg(int s, const struct msghdr *msg, int flags);
+__attribute__((weak))
+int sendmsg(int s, const struct msghdr *msg, int flags)
+{
+ return __libc_sendmsg(s, msg, flags);
+}
+
+
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
index b67e5d5..6eb8040 100644
--- a/coregrind/arch/x86-linux/vg_libpthread_unimp.c
+++ b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
@@ -152,7 +152,7 @@
//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 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"); }
@@ -209,7 +209,7 @@
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
__attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
-__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
+//__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index ba6b527..e0f4806 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -683,6 +683,21 @@
}
+/* Copied verbatim from Linuxthreads */
+/* Redefine raise() to send signal to calling thread only,
+ as per POSIX 1003.1c */
+int raise (int sig)
+{
+ int retcode = pthread_kill(pthread_self(), sig);
+ if (retcode == 0)
+ return 0;
+ else {
+ errno = retcode;
+ return -1;
+ }
+}
+
+
/* ---------------------------------------------------
THREAD-SPECIFICs
------------------------------------------------ */
@@ -1123,6 +1138,15 @@
}
+extern
+int __libc_sendmsg(int s, const struct msghdr *msg, int flags);
+__attribute__((weak))
+int sendmsg(int s, const struct msghdr *msg, int flags)
+{
+ return __libc_sendmsg(s, msg, flags);
+}
+
+
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c
index b67e5d5..6eb8040 100644
--- a/coregrind/vg_libpthread_unimp.c
+++ b/coregrind/vg_libpthread_unimp.c
@@ -152,7 +152,7 @@
//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 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"); }
@@ -209,7 +209,7 @@
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
__attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
-__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
+//__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
diff --git a/vg_libpthread.c b/vg_libpthread.c
index ba6b527..e0f4806 100644
--- a/vg_libpthread.c
+++ b/vg_libpthread.c
@@ -683,6 +683,21 @@
}
+/* Copied verbatim from Linuxthreads */
+/* Redefine raise() to send signal to calling thread only,
+ as per POSIX 1003.1c */
+int raise (int sig)
+{
+ int retcode = pthread_kill(pthread_self(), sig);
+ if (retcode == 0)
+ return 0;
+ else {
+ errno = retcode;
+ return -1;
+ }
+}
+
+
/* ---------------------------------------------------
THREAD-SPECIFICs
------------------------------------------------ */
@@ -1123,6 +1138,15 @@
}
+extern
+int __libc_sendmsg(int s, const struct msghdr *msg, int flags);
+__attribute__((weak))
+int sendmsg(int s, const struct msghdr *msg, int flags)
+{
+ return __libc_sendmsg(s, msg, flags);
+}
+
+
extern
int __libc_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen);
diff --git a/vg_libpthread_unimp.c b/vg_libpthread_unimp.c
index b67e5d5..6eb8040 100644
--- a/vg_libpthread_unimp.c
+++ b/vg_libpthread_unimp.c
@@ -152,7 +152,7 @@
//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 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"); }
@@ -209,7 +209,7 @@
__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); }
__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); }
__attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); }
-__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
+//__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); }
__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }