]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Cancellation wrapper for sendmsg(), wierd wrapper for raise().
authorJulian Seward <jseward@acm.org>
Thu, 16 May 2002 16:57:25 +0000 (16:57 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 16 May 2002 16:57:25 +0000 (16:57 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@278

coregrind/arch/x86-linux/vg_libpthread.c
coregrind/arch/x86-linux/vg_libpthread_unimp.c
coregrind/vg_libpthread.c
coregrind/vg_libpthread_unimp.c
vg_libpthread.c
vg_libpthread_unimp.c

index ba6b527ccc8f9f08bb0c910343cfb30249ea4320..e0f480669aebb96bd577ab72a422efca6ca863dd 100644 (file)
@@ -683,6 +683,21 @@ int pthread_kill(pthread_t thread, int signo)
 }
 
 
+/* 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 @@ int recv(int s, void *buf, size_t len, int flags)
 }
 
 
+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);
index b67e5d5e47b62a3537ea6ced6804994f241b92a6..6eb8040684564964bf60d7e917788b73960a5125 100644 (file)
@@ -152,7 +152,7 @@ void pthread_rwlockattr_setpshared ( void )  { unimp("pthread_rwlockattr_setpsha
 //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 msync ( void ) { vgPlain_unimp("msync"); }
 __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"); }
 
index ba6b527ccc8f9f08bb0c910343cfb30249ea4320..e0f480669aebb96bd577ab72a422efca6ca863dd 100644 (file)
@@ -683,6 +683,21 @@ int pthread_kill(pthread_t thread, int signo)
 }
 
 
+/* 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 @@ int recv(int s, void *buf, size_t len, int flags)
 }
 
 
+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);
index b67e5d5e47b62a3537ea6ced6804994f241b92a6..6eb8040684564964bf60d7e917788b73960a5125 100644 (file)
@@ -152,7 +152,7 @@ void pthread_rwlockattr_setpshared ( void )  { unimp("pthread_rwlockattr_setpsha
 //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 msync ( void ) { vgPlain_unimp("msync"); }
 __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"); }
 
index ba6b527ccc8f9f08bb0c910343cfb30249ea4320..e0f480669aebb96bd577ab72a422efca6ca863dd 100644 (file)
@@ -683,6 +683,21 @@ int pthread_kill(pthread_t thread, int signo)
 }
 
 
+/* 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 @@ int recv(int s, void *buf, size_t len, int flags)
 }
 
 
+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);
index b67e5d5e47b62a3537ea6ced6804994f241b92a6..6eb8040684564964bf60d7e917788b73960a5125 100644 (file)
@@ -152,7 +152,7 @@ void pthread_rwlockattr_setpshared ( void )  { unimp("pthread_rwlockattr_setpsha
 //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 msync ( void ) { vgPlain_unimp("msync"); }
 __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"); }