summaryrefslogtreecommitdiff
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.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c
index bcb3009675..3a6171b815 100644
--- a/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -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);
}