This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sigaction + sigwait + raise in linuxthreads


Hi!

The following patch makes sigaction, sigwait and raise do the same
in -lpthread -lc and -lc -lpthread.
Also, it fixes libpthread.a and optimizes for no -lpthread in
__libc_maybe_call2 (the threaded variant is going to be slower
anyway).
Also, it fixes the #warning: #include_next in primary source file,
{nptl,linuxthreads}/sysdeps/pthread/sigaction.c is going to be
sourced several times anyway so when there is some actual code
in the file it needs to deal with it anyway
(#include_next <sigaction.c> will first source that file and the next
one only in the second step).

2003-01-02  Jakub Jelinek  <jakub@redhat.com>

libc/
	* sysdeps/unix/sysv/linux/arm/sigaction.c (__sigaction,
	sigaction): Protect weak_alias and libc_hidden_weak with
	#ifndef LIBC_SIGACTION.
	* sysdeps/unix/sysv/linux/ia64/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/mips/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigaction.c (__sigaction,
	sigaction): Likewise.
	* sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction,
	sigaction): Likewise.  Remove SIGCANCEL handling here.
	* sysdeps/unix/sysv/linux/sigaction.c (__sigaction, sigaction):
	Likewise.
linuxthreads/
	* sysdeps/pthread/bits/libc-lock.h (__libc_maybe_call2): Add
	__builtin_expect.
	* sysdeps/pthread/sigaction.c: New file.
	* sysdeps/unix/sysv/linux/raise.c: New file.
	* sysdeps/unix/sysv/linux/sigwait.c: New file.
	* sysdeps/unix/sysv/linux/fork.c (__pthread_fork): Protect
	weak_extern with #ifndef SHARED.
	* sysdeps/unix/sysv/linux/jmp-unwind.c (__pthread_cleanup_upto):
	Likewise.
	* signals.c (__sigaction): Renamed to...
	(__pthread_sigaction): ... this.
	(__sigaction): New strong alias, #ifdef SHARED only.
	(sigaction): Protect with #ifdef SHARED.
	(sigwait): Renamed to...
	(__pthread_sigwait): ... this.
	(sigwait): New strong alias, #ifdef SHARED only.
	(raise): Renamed to...
	(__pthread_raise): ... this.
	(raise): New strong alias, #ifdef SHARED only.
	* internals.h (__pthread_sigaction, __pthread_sigwait,
	__pthread_raise): New prototypes.
	(struct pthread_functions): Add ptr_pthread_sigaction,
	ptr_pthread_sigwait, ptr_pthread_raise.
	* pthread.c (pthread_functions): Renamed to...
	(__pthread_functions): ... this.  No longer static, no longer
	SHARED only.  Initialize ptr_pthread_sigaction, ptr_pthread_sigwait
	and ptr_pthread_raise.
	[SHARED] (ptr_pthread_functions): Change to &__pthread_functions.
	* libc-cancellation.c (__pthread_thread_self): Remove weak_extern.
	* ptfork.c (__fork, __vfork): Protect with #ifdef SHARED.
	* ptlongjmp.c (siglongjmp, longjmp): Protect with #ifdef SHARED.

	* Makefile (tests, tests-static): Add tst-cancel-static.
	* tst-cancel-static.c: New test.
nptl/
	* sysdeps/pthread/sigaction.c (SIGCANCEL): Only define if
	LIBC_SIGACTION was not yet defined.
	[!defined LIBC_SIGACTION]: Define LIBC_SIGACTION, #include self.
	[!defined LIBC_SIGACTION] (__sigaction): New function and
	libc_hidden_weak.
	[!defined LIBC_SIGACTION] (sigaction): New weak_alias.
	[defined LIBC_SIGACTION]: #include_next <sigaction.c>.

--- libc/linuxthreads/sysdeps/pthread/bits/libc-lock.h.jj	2002-12-28 11:55:45.000000000 +0100
+++ libc/linuxthreads/sysdeps/pthread/bits/libc-lock.h	2003-01-01 00:00:00.000000000 +0100
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  LinuxThreads version.
-   Copyright (C) 1996,1997,1998,1999,2000,2001,2002
+   Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -108,7 +108,7 @@ typedef pthread_key_t __libc_key_t;
 #endif
 #if defined _LIBC && !defined NOT_IN_libc && defined SHARED
 # define __libc_maybe_call2(FUNC, ARGS, ELSE) \
-  ({__libc_pthread_functions.ptr_##FUNC != NULL \
+  ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \
     ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; })
 #else
 # define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE)
--- libc/linuxthreads/sysdeps/pthread/sigaction.c.jj	2003-01-01 21:33:48.000000000 +0100
+++ libc/linuxthreads/sysdeps/pthread/sigaction.c	2003-01-02 00:03:05.000000000 +0100
@@ -0,0 +1,55 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This is tricky.  GCC doesn't like #include_next in the primary
+   source file and even if it did, the first #include_next is this
+   exact file anyway.  */
+#ifndef LIBC_SIGACTION
+
+# include <bits/libc-lock.h>
+
+# define LIBC_SIGACTION	1
+
+# include <linuxthreads/sysdeps/pthread/sigaction.c>
+
+# ifndef NOT_IN_libc
+#  ifndef SHARED
+weak_extern (__pthread_sigaction)
+#  endif
+
+int
+__sigaction (sig, act, oact)
+     int sig;
+     const struct sigaction *act;
+     struct sigaction *oact;
+{
+  return __libc_maybe_call2 (pthread_sigaction, (sig, act, oact),
+			     __libc_sigaction (sig, act, oact));
+}
+# else
+weak_alias (__libc_sigaction, __sigaction)
+# endif
+libc_hidden_weak (__sigaction)
+weak_alias (__sigaction, sigaction)
+
+#else
+
+# include_next <sigaction.c>
+
+#endif /* LIBC_SIGACTION */
--- libc/linuxthreads/sysdeps/unix/sysv/linux/raise.c.jj	2003-01-01 20:21:07.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/raise.c	2003-01-02 00:04:56.000000000 +0100
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1996, 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <signal.h>
+#include <unistd.h>
+#include <bits/libc-lock.h>
+
+#ifndef SHARED
+weak_extern (__pthread_raise)
+#endif
+
+/* Raise the signal SIG.  */
+int
+raise (sig)
+     int sig;
+{
+  return __libc_maybe_call2 (pthread_raise, (sig),
+			     __kill (__getpid (), sig));
+}
+libc_hidden_def (raise)
+weak_alias (raise, gsignal)
--- libc/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c.jj	2003-01-01 20:25:54.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c	2003-01-02 00:05:16.000000000 +0100
@@ -0,0 +1,84 @@
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+#include <bits/libc-lock.h>
+
+extern int __syscall_rt_sigtimedwait (const sigset_t *__unbounded, siginfo_t *__unbounded,
+				      const struct timespec *__unbounded, size_t);
+
+
+/* Return any pending signal or wait for one for the given time.  */
+static inline int
+do_sigwait (const sigset_t *set, int *sig)
+{
+  int ret;
+
+  /* XXX The size argument hopefully will have to be changed to the
+     real size of the user-level sigset_t.  */
+#ifdef INTERNAL_SYSCALL
+  ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
+			  NULL, NULL, _NSIG / 8);
+  if (! INTERNAL_SYSCALL_ERROR_P (ret))
+    {
+      *sig = ret;
+      ret = 0;
+    }
+  else
+    ret = INTERNAL_SYSCALL_ERRNO (ret);
+#else
+  ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
+			NULL, NULL, _NSIG / 8);
+  if (ret != -1)
+    {
+      *sig = ret;
+      ret = 0;
+    }
+  else
+    ret = errno;
+#endif
+
+  return ret;
+}
+
+#ifndef SHARED
+weak_extern (__pthread_sigwait)
+#endif
+
+int
+__sigwait (set, sig)
+     const sigset_t *set;
+     int *sig;
+{
+#ifndef NOT_IN_libc
+  return __libc_maybe_call2 (pthread_sigwait, (set, sig),
+			     do_sigwait (set, sig));
+#else
+  return do_sigwait (set, sig);
+#endif
+}
+libc_hidden_def (__sigwait)
+weak_alias (__sigwait, sigwait)
+strong_alias (__sigwait, __libc_sigwait)
--- libc/linuxthreads/sysdeps/unix/sysv/linux/fork.c.jj	2002-12-31 14:27:53.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/fork.c	2003-01-02 00:04:10.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -21,7 +21,9 @@
 #include <fork.h>
 #include <bits/libc-lock.h>
 
+#ifndef SHARED
 weak_extern (__pthread_fork);
+#endif
 
 struct fork_block __fork_block =
 {
--- libc/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c	2003-01-02 00:04:32.000000000 +0100
@@ -1,5 +1,5 @@
 /* _longjmp_unwind -- Clean up stack frames unwound by longjmp.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,9 @@
 #include <stddef.h>
 #include <bits/libc-lock.h>
 
+#ifndef SHARED
 weak_extern (__pthread_cleanup_upto);
+#endif
 
 void
 _longjmp_unwind (jmp_buf env, int val)
--- libc/linuxthreads/signals.c.jj	2002-05-10 11:53:31.000000000 +0200
+++ libc/linuxthreads/signals.c	2003-01-02 01:28:56.000000000 +0100
@@ -73,8 +73,8 @@ union sighandler __sighandler[NSIG] =
 
 /* The wrapper around sigaction.  Install our own signal handler
    around the signal. */
-int __sigaction(int sig, const struct sigaction * act,
-              struct sigaction * oact)
+int __pthread_sigaction(int sig, const struct sigaction * act,
+			struct sigaction * oact)
 {
   struct sigaction newact;
   struct sigaction *newactp;
@@ -118,10 +118,13 @@ int __sigaction(int sig, const struct si
     }
   return 0;
 }
-strong_alias(__sigaction, sigaction)
+#ifdef SHARED
+strong_alias(__pthread_sigaction, __sigaction)
+strong_alias(__pthread_sigaction, sigaction)
+#endif
 
 /* sigwait -- synchronously wait for a signal */
-int sigwait(const sigset_t * set, int * sig)
+int __pthread_sigwait(const sigset_t * set, int * sig)
 {
   volatile pthread_descr self = thread_self();
   sigset_t mask;
@@ -173,10 +176,13 @@ int sigwait(const sigset_t * set, int * 
   *sig = THREAD_GETMEM(self, p_signal);
   return 0;
 }
+#ifdef SHARED
+strong_alias (__pthread_sigwait, sigwait)
+#endif
 
 /* Redefine raise() to send signal to calling thread only,
    as per POSIX 1003.1c */
-int raise (int sig)
+int __pthread_raise (int sig)
 {
   int retcode = pthread_kill(pthread_self(), sig);
   if (retcode == 0)
@@ -186,3 +192,6 @@ int raise (int sig)
     return -1;
   }
 }
+#ifdef SHARED
+strong_alias (__pthread_raise, raise)
+#endif
--- libc/linuxthreads/internals.h.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/internals.h	2003-01-01 00:00:00.000000000 +0100
@@ -452,6 +452,10 @@ extern void __pthread_sighandler(int sig
 extern void __pthread_sighandler_rt(int signo, struct siginfo *si,
 				    struct ucontext *uc);
 extern void __pthread_null_sighandler(int sig);
+extern int __pthread_sigaction (int sig, const struct sigaction *act,
+				struct sigaction *oact);
+extern int __pthread_sigwait (const sigset_t *set, int *sig);
+extern int __pthread_raise (int sig);
 
 /* Cancellation.  */
 extern int __pthread_enable_asynccancel (void) attribute_hidden;
@@ -528,10 +532,14 @@ struct pthread_functions
   void (*ptr_pthread_cleanup_upto) (__jmp_buf target,
 				    char *targetframe);
   pthread_descr (*ptr_pthread_thread_self) (void);
-  int (*ptr_pthread_internal_tsd_set) (int key, const void * pointer);
+  int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer);
   void * (*ptr_pthread_internal_tsd_get) (int key);
   void ** __attribute__ ((__const__))
     (*ptr_pthread_internal_tsd_address) (int key);
+  int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act,
+				struct sigaction *oact);
+  int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig);
+  int (*ptr_pthread_raise) (int sig);
 };
 
 /* Variable in libc.so.  */
--- libc/linuxthreads/pthread.c.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/pthread.c	2003-01-02 01:26:30.000000000 +0100
@@ -230,8 +230,7 @@ extern void *__dso_handle __attribute__ 
 extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
 #endif
 
-#ifdef SHARED
-static struct pthread_functions pthread_functions =
+struct pthread_functions __pthread_functions =
   {
 #if !(USE_TLS && HAVE___THREAD)
     .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
@@ -275,9 +274,13 @@ static struct pthread_functions pthread_
     .ptr_pthread_setcanceltype = __pthread_setcanceltype,
     .ptr_pthread_do_exit = __pthread_do_exit,
     .ptr_pthread_thread_self = __pthread_thread_self,
-    .ptr_pthread_cleanup_upto = __pthread_cleanup_upto
+    .ptr_pthread_cleanup_upto = __pthread_cleanup_upto,
+    .ptr_pthread_sigaction = __pthread_sigaction,
+    .ptr_pthread_sigwait = __pthread_sigwait,
+    .ptr_pthread_raise = __pthread_raise
   };
-# define ptr_pthread_functions &pthread_functions
+#ifdef SHARED
+# define ptr_pthread_functions &__pthread_functions
 #else
 # define ptr_pthread_functions NULL
 #endif
--- libc/linuxthreads/libc-cancellation.c.jj	2002-12-28 11:55:44.000000000 +0100
+++ libc/linuxthreads/libc-cancellation.c	2003-01-02 00:01:18.000000000 +0100
@@ -29,7 +29,6 @@
 
 # ifndef SHARED
 weak_extern (__pthread_do_exit)
-weak_extern (__pthread_thread_self)
 # endif
 
 int __libc_multiple_threads attribute_hidden;
--- libc/linuxthreads/ptfork.c.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/ptfork.c	2003-01-02 01:28:20.000000000 +0100
@@ -78,6 +78,7 @@ pid_t __pthread_fork (struct fork_block 
   return pid;
 }
 
+#ifdef SHARED
 pid_t __fork (void)
 {
   return __libc_fork ();
@@ -89,3 +90,4 @@ pid_t __vfork(void)
   return __libc_fork ();
 }
 weak_alias (__vfork, vfork);
+#endif
--- libc/linuxthreads/Makefile.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/Makefile	2002-12-31 10:12:51.000000000 +0100
@@ -92,8 +92,8 @@ test-srcs = tst-signal
 tests-reverse += tst-cancel5
 
 ifeq ($(build-static),yes)
-tests += tststatic tst-static-locale
-tests-static += tststatic tst-static-locale
+tests += tststatic tst-static-locale tst-cancel-static
+tests-static += tststatic tst-static-locale tst-cancel-static
 endif
 
 ifeq (yes,$(build-shared))
--- libc/linuxthreads/ptlongjmp.c.jj	2002-12-31 10:12:51.000000000 +0100
+++ libc/linuxthreads/ptlongjmp.c	2003-01-02 01:30:23.000000000 +0100
@@ -59,6 +59,7 @@ void __pthread_cleanup_upto (__jmp_buf t
     THREAD_SETMEM(self, p_in_sighandler, NULL);
 }
 
+#ifdef SHARED
 void siglongjmp (sigjmp_buf env, int val)
 {
   __libc_siglongjmp (env, val);
@@ -68,3 +69,4 @@ void longjmp (jmp_buf env, int val)
 {
   __libc_longjmp (env, val);
 }
+#endif
--- libc/linuxthreads/tst-cancel-static.c.jj	2003-01-02 13:25:02.000000000 +0100
+++ libc/linuxthreads/tst-cancel-static.c	2002-12-28 11:55:45.000000000 +0100
@@ -0,0 +1 @@
+#include "tst-cancel4.c"
--- libc/sysdeps/unix/sysv/linux/arm/sigaction.c.jj	2002-09-28 22:39:39.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/arm/sigaction.c	2003-01-01 21:28:28.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -149,6 +149,9 @@ __libc_sigaction (sig, act, oact)
   return result;
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
+#endif
--- libc/sysdeps/unix/sysv/linux/i386/sigaction.c.jj	2002-12-22 21:09:41.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/i386/sigaction.c	2003-01-01 21:29:32.000000000 +0100
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-   Copyright (C) 1991,95,96,97,98,99,2000,02 Free Software Foundation, Inc.
+   Copyright (C) 1991,95,96,97,98,99,2000,02,03 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -154,27 +154,10 @@ __libc_sigaction (int sig, const struct 
 }
 libc_hidden_def (__libc_sigaction)
 
-#ifndef SIGCANCEL
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
-#else
-int
-__sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-  if (sig == SIGCANCEL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __libc_sigaction (sig, act, oact);
-}
-libc_hidden_weak (__sigaction)
-weak_alias (__sigaction, sigaction)
 #endif
 
 /* NOTE: Please think twice before making any changes to the bits of
--- libc/sysdeps/unix/sysv/linux/ia64/sigaction.c.jj	2002-09-28 22:39:42.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/ia64/sigaction.c	2003-01-01 21:29:59.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Linux/IA64 specific sigaction
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
@@ -50,6 +50,9 @@ __libc_sigaction (sig, act, oact)
 			 CHECK_1_NULL_OK (act), CHECK_1_NULL_OK (oact), _NSIG / 8);
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_def (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
+#endif
--- libc/sysdeps/unix/sysv/linux/mips/sigaction.c.jj	2002-09-28 22:39:45.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/mips/sigaction.c	2003-01-01 21:31:00.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -135,6 +135,9 @@ __libc_sigaction (sig, act, oact)
 #endif
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
+#endif
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c.jj	2002-09-28 22:39:49.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c	2003-01-01 21:31:29.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -46,6 +46,9 @@ __libc_sigaction (sig, act, oact)
   return INLINE_SYSCALL (rt_sigaction, 4, sig, act, oact, _NSIG / 8);
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
+#endif
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c.jj	2002-09-28 22:39:51.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c	2003-01-01 21:32:02.000000000 +0100
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC.
-   Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx), 1997.
 
@@ -135,9 +135,12 @@ __libc_sigaction (int sig, __const struc
   return -1;
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction);
+#endif
 
 static void
 __rt_sigreturn_stub (void)
--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c.jj	2002-09-28 22:39:51.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c	2003-01-01 21:32:30.000000000 +0100
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC64.
-   Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -64,9 +64,12 @@ __libc_sigaction (int sig, __const struc
   return ret;
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction);
+#endif
 
 static void
 __rt_sigreturn_stub (void)
--- libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c.jj	2002-11-27 12:30:24.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c	2003-01-01 21:33:14.000000000 +0100
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/x86-64.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -81,9 +81,12 @@ __libc_sigaction (int sig, const struct 
   return result;
 }
 libc_hidden_def (__libc_sigaction)
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
+#endif
 
 /* NOTE: Please think twice before making any changes to the bits of
    code below.  GDB needs some intimate knowledge about it to
--- libc/sysdeps/unix/sysv/linux/sigaction.c.jj	2002-09-28 22:39:36.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/sigaction.c	2003-01-01 21:26:42.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -134,25 +134,8 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
-#ifndef SIGCANCEL
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
 weak_alias (__libc_sigaction, sigaction)
-#else
-int
-__sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-  if (sig == SIGCANCEL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __libc_sigaction (sig, act, oact);
-}
-libc_hidden_weak (__sigaction)
-weak_alias (__sigaction, sigaction)
 #endif
--- libc/nptl/sysdeps/pthread/sigaction.c.jj	2003-01-01 21:25:27.000000000 +0100
+++ libc/nptl/sysdeps/pthread/sigaction.c	2003-01-02 00:03:32.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* 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.
 
@@ -17,8 +17,37 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+/* This is tricky.  GCC doesn't like #include_next in the primary
+   source file and even if it did, the first #include_next is this
+   exact file anyway.  */
+#ifndef LIBC_SIGACTION
+
 /* We use the libc implementation but we tell it to not allow
    SIGCANCEL to be handled.  */
-#define SIGCANCEL __SIGRTMIN
+# define SIGCANCEL __SIGRTMIN
+# define LIBC_SIGACTION	1
+
+# include <nptl/sysdeps/pthread/sigaction.c>
+
+int
+__sigaction (sig, act, oact)
+     int sig;
+     const struct sigaction *act;
+     struct sigaction *oact;
+{
+  if (sig == SIGCANCEL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __libc_sigaction (sig, act, oact);
+}
+libc_hidden_weak (__sigaction)
+weak_alias (__sigaction, sigaction)
+
+#else
+
+# include_next <sigaction.c>
 
-#include_next <sigaction.c>
+#endif /* LIBC_SIGACTION */

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]