From bd215ef170fb85b7572b617dacdeab26edd3d21c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 25 Sep 2016 20:28:03 +0200 Subject: 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 --- .../sysdeps/unix/sysv/linux/Makefile.commonarch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c | 51 ---------------------- .../nptl/sysdeps/unix/sysv/linux/pthread_kill.c | 10 ----- libpthread/nptl/sysdeps/unix/sysv/linux/raise.c | 21 +-------- 4 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch index 81ce813a9..57481fdb5 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch +++ b/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)) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c deleted file mode 100644 index 6784b1b58..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c +++ /dev/null @@ -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 , 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 - . */ - -#include -#include -#include -#include -#include - - -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 -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c index 5bc6e0651..e27ab5104 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c +++ b/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); diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c index 8aa4830c0..6b159384f 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c +++ b/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 , 2002. @@ -21,17 +21,13 @@ #include #include #include -#include 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) -- cgit v1.2.3