From: Julian Seward Date: Thu, 16 May 2002 16:57:25 +0000 (+0000) Subject: Cancellation wrapper for sendmsg(), wierd wrapper for raise(). X-Git-Tag: svn/VALGRIND_1_0_3~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9360e0621cf561d3367afeeaf302f31f626f0542;p=thirdparty%2Fvalgrind.git Cancellation wrapper for sendmsg(), wierd wrapper for raise(). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@278 --- diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c index ba6b527ccc..e0f480669a 100644 --- a/coregrind/arch/x86-linux/vg_libpthread.c +++ b/coregrind/arch/x86-linux/vg_libpthread.c @@ -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); diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c index b67e5d5e47..6eb8040684 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_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"); } diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c index ba6b527ccc..e0f480669a 100644 --- a/coregrind/vg_libpthread.c +++ b/coregrind/vg_libpthread.c @@ -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); diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c index b67e5d5e47..6eb8040684 100644 --- a/coregrind/vg_libpthread_unimp.c +++ b/coregrind/vg_libpthread_unimp.c @@ -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"); } diff --git a/vg_libpthread.c b/vg_libpthread.c index ba6b527ccc..e0f480669a 100644 --- a/vg_libpthread.c +++ b/vg_libpthread.c @@ -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); diff --git a/vg_libpthread_unimp.c b/vg_libpthread_unimp.c index b67e5d5e47..6eb8040684 100644 --- a/vg_libpthread_unimp.c +++ b/vg_libpthread_unimp.c @@ -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"); }