about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/raise.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-07-08 03:40:49 +0000
committerUlrich Drepper <drepper@redhat.com>2003-07-08 03:40:49 +0000
commitdb54f488ee24b14027c485e0005950dfdd5ef885 (patch)
tree2a07a1746c1ffa758a34484f65263c737818d162 /nptl/sysdeps/unix/sysv/linux/raise.c
parent5fee5ad11c5307141f76aa7ea28ec1e1b6418fea (diff)
downloadglibc-db54f488ee24b14027c485e0005950dfdd5ef885.tar.gz
glibc-db54f488ee24b14027c485e0005950dfdd5ef885.tar.xz
glibc-db54f488ee24b14027c485e0005950dfdd5ef885.zip
Update.
2003-07-07  Ulrich Drepper  <drepper@redhat.com>

	* 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.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/raise.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/raise.c15
1 files changed, 14 insertions, 1 deletions
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 <signal.h>
 #include <sysdep.h>
 #include <nptl/pthreadP.h>
+#include <kernel-features.h>
 
 
 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)