From 3244f2ca6457e2b97c8ece6fa98db86d0325a4c9 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 13 Jun 2002 17:29:53 +0000 Subject: [PATCH] Make recvfrom() block only the calling thread, not the whole system ( same trick as used for accept() ). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@415 --- coregrind/arch/x86-linux/vg_libpthread.c | 2 ++ coregrind/vg_libpthread.c | 2 ++ vg_libpthread.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/coregrind/arch/x86-linux/vg_libpthread.c +++ b/coregrind/arch/x86-linux/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); } diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/coregrind/vg_libpthread.c +++ b/coregrind/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); } diff --git a/vg_libpthread.c b/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/vg_libpthread.c +++ b/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); } -- 2.47.3