From db54f488ee24b14027c485e0005950dfdd5ef885 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 8 Jul 2003 03:40:49 +0000 Subject: Update. 2003-07-07 Ulrich Drepper * descr.h (struct pthread): Add pid field. * allocatestack.c (allocate_stack): Initialize pid field in descriptor. (__reclaim_stacks): Likewise. * init.c (sigcancel_handler): If __ASSUME_CORRECT_SI_PID is defined also check for PID of the signal source. (__pthread_initialize_minimal_internal): Also initialize pid field of initial thread's descriptor. * pthread_cancel.c: Use tgkill instead of tkill if possible. * sysdeps/unix/sysv/linux/fork.c: Likewise. * sysdeps/unix/sysv/linux/pt-raise.c: Likewise. * sysdeps/unix/sysv/linux/pthread_kill.c: Likewise. * sysdeps/unix/sysv/linux/raise.c: Likewise. --- nptl/sysdeps/unix/sysv/linux/raise.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'nptl/sysdeps/unix/sysv/linux/raise.c') diff --git a/nptl/sysdeps/unix/sysv/linux/raise.c b/nptl/sysdeps/unix/sysv/linux/raise.c index 24a00b1e4d..25d3ed8afd 100644 --- a/nptl/sysdeps/unix/sysv/linux/raise.c +++ b/nptl/sysdeps/unix/sysv/linux/raise.c @@ -21,6 +21,7 @@ #include #include #include +#include int @@ -28,7 +29,7 @@ raise (sig) int sig; { struct pthread *pd = THREAD_SELF; - pid_t selftid = pd->tid; + pid_t selftid = THREAD_GETMEM (pd, tid); if (selftid == 0) { /* This system call is not supposed to fail. */ @@ -39,9 +40,21 @@ raise (sig) selftid = INLINE_SYSCALL (gettid, 0); #endif THREAD_SETMEM (pd, tid, selftid); + + /* In this case the TID and PID are the same. */ + THREAD_SETMEM (pd, pid, selftid); } +#if __ASSUME_TGKILL + return INLINE_SYSCALL (tgkill, 3, THREAD_GETMEM (pd, pid), selftid, sig); +#else +# ifdef __NR_tgkill + int res = INLINE_SYSCALL (tgkill, 3, THREAD_GETMEM (pd, pid), selftid, sig); + if (res != -1 || errno != ENOSYS) + return res; +# endif return INLINE_SYSCALL (tkill, 2, selftid, sig); +#endif } libc_hidden_def (raise) weak_alias (raise, gsignal) -- cgit 1.4.1