Преглед изворни кода

always assume tgkill is present

We do not support 2.4 Linux kernels anyway, and almost
all newer 2.6 kernels should have tgkill syscall.

Cleanup the raise situation, pt-raise.c is unused, sync
raise.c with latest GNU libc.

Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Waldemar Brodkorb пре 7 година
родитељ
комит
bd215ef170

+ 0 - 12
libc/sysdeps/linux/common/bits/kernel-features.h

@@ -382,18 +382,6 @@
 # define __ASSUME_CORRECT_SI_PID	1
 #endif
 
-/* The tgkill syscall was instroduced for i386 in 2.5.75.  For Alpha
-   it was introduced in 2.6.0-test1 which unfortunately cannot be
-   distinguished from 2.6.0.  On x86-64, ppc, and ppc64 it was
-   introduced in 2.6.0-test3. */
-#if (__LINUX_KERNEL_VERSION >= 132427 && defined __i386__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __alpha__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __x86_64__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
-# define __ASSUME_TGKILL	1
-#endif
-
 /* The utimes syscall has been available for some architectures
    forever.  For x86 it was introduced after 2.5.75, for x86-64,
    ppc, and ppc64 it was introduced in 2.6.0-test3.  */

+ 0 - 10
libpthread/nptl/allocatestack.c

@@ -996,18 +996,8 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
 
   int val;
   INTERNAL_SYSCALL_DECL (err);
-#if defined (__ASSUME_TGKILL) && __ASSUME_TGKILL
   val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
 			  t->tid, SIGSETXID);
-#else
-# ifdef __NR_tgkill
-  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
-			  t->tid, SIGSETXID);
-  if (INTERNAL_SYSCALL_ERROR_P (val, err)
-      && INTERNAL_SYSCALL_ERRNO (val, err) == ENOSYS)
-# endif
-    val = INTERNAL_SYSCALL (tkill, err, 2, t->tid, SIGSETXID);
-#endif
 
   /* If this failed, it must have had not started yet or else exited.  */
   if (!INTERNAL_SYSCALL_ERROR_P (val, err))

+ 0 - 11
libpthread/nptl/pthread_cancel.c

@@ -75,20 +75,9 @@ pthread_cancel (
 	     a signal handler.  But this is no allowed, pthread_cancel
 	     is not guaranteed to be async-safe.  */
 	  int val;
-#if defined(__ASSUME_TGKILL) && __ASSUME_TGKILL
 	  val = INTERNAL_SYSCALL (tgkill, err, 3,
 				  THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
 				  SIGCANCEL);
-#else
-# ifdef __NR_tgkill
-	  val = INTERNAL_SYSCALL (tgkill, err, 3,
-				  THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
-				  SIGCANCEL);
-	  if (INTERNAL_SYSCALL_ERROR_P (val, err)
-	      && INTERNAL_SYSCALL_ERRNO (val, err) == ENOSYS)
-# endif
-	    val = INTERNAL_SYSCALL (tkill, err, 2, pd->tid, SIGCANCEL);
-#endif
 
 	  if (INTERNAL_SYSCALL_ERROR_P (val, err))
 	    result = INTERNAL_SYSCALL_ERRNO (val, err);

+ 0 - 4
libpthread/nptl/sysdeps/pthread/createthread.c

@@ -105,13 +105,9 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
 		 send it the cancellation signal.  */
 	      INTERNAL_SYSCALL_DECL (err2);
 	    err_out:
-#if defined (__ASSUME_TGKILL) && __ASSUME_TGKILL
 	      (void) INTERNAL_SYSCALL (tgkill, err2, 3,
 				       THREAD_GETMEM (THREAD_SELF, pid),
 				       pd->tid, SIGCANCEL);
-#else
-	      (void) INTERNAL_SYSCALL (tkill, err2, 2, pd->tid, SIGCANCEL);
-#endif
 
 	      return (INTERNAL_SYSCALL_ERROR_P (res, err)
 		      ? INTERNAL_SYSCALL_ERRNO (res, err)

+ 0 - 1
libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch

@@ -95,7 +95,6 @@ endif
 
 libpthread-a-y += $(if $(DOPIC),$(libpthread_linux_OBJS:.o=.os),$(libpthread_linux_OBJS))
 libpthread-so-y += $(libpthread_linux_OBJS:.o=.oS)
-libpthread-so-y += $(libpthread_linux_OUT)/pt-raise.oS
 
 libc_linux_OBJS := $(libc_linux_arch_OBJS)
 libc_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(libc_linux_CSRC))

+ 0 - 51
libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c

@@ -1,51 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <sysdep.h>
-#include <tls.h>
-#include <bits/kernel-features.h>
-
-
-int
-raise (
-     int sig)
-{
-#if (defined(__ASSUME_TGKILL) && __ASSUME_TGKILL) || defined __NR_tgkill
-  /* raise is an async-safe function.  It could be called while the
-     fork function temporarily invalidated the PID field.  Adjust for
-     that.  */
-  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (pid < 0, 0))
-    pid = -pid;
-#endif
-
-#if defined(__ASSUME_TGKILL) && __ASSUME_TGKILL
-  return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
-			 sig);
-#else
-# ifdef __NR_tgkill
-  int res = INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
-			    sig);
-  if (res != -1 || errno != ENOSYS)
-    return res;
-# endif
-  return INLINE_SYSCALL (tkill, 2, THREAD_GETMEM (THREAD_SELF, tid), sig);
-#endif
-}

+ 0 - 10
libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c

@@ -58,18 +58,8 @@ __pthread_kill (
      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;
-#if defined(__ASSUME_TGKILL) && __ASSUME_TGKILL
   val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
 			  tid, signo);
-#else
-# ifdef __NR_tgkill
-  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
-			  tid, signo);
-  if (INTERNAL_SYSCALL_ERROR_P (val, err)
-      && INTERNAL_SYSCALL_ERRNO (val, err) == ENOSYS)
-# endif
-    val = INTERNAL_SYSCALL (tkill, err, 2, tid, signo);
-#endif
 
   return (INTERNAL_SYSCALL_ERROR_P (val, err)
 	  ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);

+ 2 - 19
libpthread/nptl/sysdeps/unix/sysv/linux/raise.c

@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,17 +21,13 @@
 #include <signal.h>
 #include <sysdep.h>
 #include <pthreadP.h>
-#include <bits/kernel-features.h>
 
 
 int
-raise (
-     int sig)
+raise (int sig)
 {
   struct pthread *pd = THREAD_SELF;
-#if (defined(__ASSUME_TGKILL) && __ASSUME_TGKILL) || defined __NR_tgkill
   pid_t pid = THREAD_GETMEM (pd, pid);
-#endif
   pid_t selftid = THREAD_GETMEM (pd, tid);
   if (selftid == 0)
     {
@@ -44,30 +40,17 @@ raise (
 #endif
       THREAD_SETMEM (pd, tid, selftid);
 
-#if (defined(__ASSUME_TGKILL) && __ASSUME_TGKILL) || defined __NR_tgkill
       /* We do not set the PID field in the TID here since we might be
 	 called from a signal handler while the thread executes fork.  */
       pid = selftid;
-#endif
     }
-#if (defined(__ASSUME_TGKILL) && __ASSUME_TGKILL) || defined __NR_tgkill
   else
     /* raise is an async-safe function.  It could be called while the
        fork/vfork function temporarily invalidated the PID field.  Adjust for
        that.  */
     if (__builtin_expect (pid <= 0, 0))
       pid = (pid & INT_MAX) == 0 ? selftid : -pid;
-#endif
 
-#if defined(__ASSUME_TGKILL) && __ASSUME_TGKILL
   return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
-#else
-# ifdef __NR_tgkill
-  int res = INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
-  if (res != -1 || errno != ENOSYS)
-    return res;
-# endif
-  return INLINE_SYSCALL (tkill, 2, selftid, sig);
-#endif
 }
 libc_hidden_def (raise)

+ 0 - 2
libpthread/nptl/sysdeps/xtensa/Makefile.arch

@@ -15,8 +15,6 @@
 # License along with the GNU C Library; see the file COPYING.LIB.  If
 # not, see <http://www.gnu.org/licenses/>.
 
-CFLAGS-pt-raise.c = -DNOT_IN_libc -DIS_IN_libpthread
-
 ASFLAGS-dl-tlsdesc.S = -DNOT_IN_libc=1
 ASFLAGS-pthread_spin_lock.S = -DNOT_IN_libc -DIS_IN_libpthread
 ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc -DIS_IN_libpthread