Implement tcdrain in the pthread library. The fact that this function
is missing was reported in bug #70344 but the reporter then closed the
bug saying that they were using the wrong version of valgrind.

Patch from Henrik Algestam <algestam@home.se>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2346 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index 214dc92..339808a 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -2206,6 +2206,16 @@
 
 
 extern
+int __libc_tcdrain(int fd);
+WEAK
+int __tcdrain(int fd)
+{
+   __my_pthread_testcancel();
+   return __libc_tcdrain(fd);
+}
+
+
+extern
 int __libc_fsync(int fd);
 WEAK
 int fsync(int fd)
@@ -2383,6 +2393,7 @@
 weak_alias (__pwrite64, pwrite64)
 weak_alias(__nanosleep, nanosleep)
 weak_alias(__pause, pause)
+weak_alias(__tcdrain, tcdrain)
 
 
 extern  
diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c
index 92259e3..f906023 100644
--- a/coregrind/vg_libpthread_unimp.c
+++ b/coregrind/vg_libpthread_unimp.c
@@ -220,7 +220,7 @@
 //__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 tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
+//__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); }
 //--//__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); }
 
 //__attribute__((weak)) void pthread_attr_getguardsize ( void )