about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/pthread_kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/pthread_kill.c')
-rw-r--r--sysdeps/unix/sysv/linux/pthread_kill.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c
index bcb3009675..cc109973cc 100644
--- a/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -21,6 +21,7 @@
 #include <pthreadP.h>
 #include <tls.h>
 #include <sysdep.h>
+#include <unistd.h>
 
 
 int
@@ -49,15 +50,9 @@ __pthread_kill (pthread_t threadid, int signo)
   /* We have a special syscall to do the work.  */
   INTERNAL_SYSCALL_DECL (err);
 
-  /* One comment: The PID field in the TCB can temporarily be changed
-     (in fork).  But this must not affect this code here.  Since this
-     function would have to be called while the thread is executing
-     fork, it would have to happen in a signal handler.  But this is
-     no allowed, pthread_kill is not guaranteed to be async-safe.  */
-  int val;
-  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
-			  tid, signo);
+  pid_t pid = __getpid ();
 
+  int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo);
   return (INTERNAL_SYSCALL_ERROR_P (val, err)
 	  ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
 }