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/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);