about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sigaction.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-26 23:37:38 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-26 23:37:38 +0000
commit958f238f3619373d3dbc106d3cda3c467b3419b1 (patch)
tree9d15d47658aeaae08ee7e5e5e9d4a63d034caa49 /sysdeps/unix/sysv/linux/sigaction.c
parent475e390e80a950a8746dc0b88341742dc99014e4 (diff)
downloadglibc-958f238f3619373d3dbc106d3cda3c467b3419b1.tar.gz
glibc-958f238f3619373d3dbc106d3cda3c467b3419b1.tar.xz
glibc-958f238f3619373d3dbc106d3cda3c467b3419b1.zip
Update.
1999-05-26  Ulrich Drepper  <drepper@cygnus.com>

	* config.h.in: Add __LINUX_KERNEL_VERSION.
	* configure.in: Recognize --enable-kernel.
	* sysdeps/unix/sysv/linux/configure.in: Check for correct kernel
	headers if --enable-kernel is given and set __LINUX_KERNEL_VERSION
	appropriately.
	* sysdeps/unix/sysv/linux/init-first.c: If minimal kernel version is
	given perform runtime test.

	* sysdeps/unix/sysv/linux/kernel-features.h: New file.
	* sysdeps/unix/sysv/linux/getcwd.c: Elide compatibility code if
	minimal supported kernel is known to have the feature.
	* sysdeps/unix/sysv/linux/poll.c: Likewise.
	* sysdeps/unix/sysv/linux/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c: Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c: Likewise.
	* sysdeps/unix/sysv/linux/testrtsig.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/chown.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pwrite64.c: Likewise.

	* sysdeps/unix/sysv/linux/sysctl.c: Add __sysctl alias.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sigaction.c')
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index a5580cc0e6..40f9bbc252 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -23,20 +23,27 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
+#include "kernel-features.h"
+
 /* The difference here is that the sigaction structure used in the
    kernel is not the same as we use in the libc.  Therefore we must
    translate it here.  */
 #include <kernel_sigaction.h>
 
+#if __ASSUME_REALTIME_SIGNALS == 0
+/* The variable is shared between all wrappers around signal handling
+   functions which have RT equivalents.  This is the definition.  */
+int __libc_missing_rt_sigs;
+
 extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
 				struct old_kernel_sigaction *);
+# define rtsignals_guaranteed 0
+#else
+# define rtsignals_guaranteed 1
+#endif
 extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
 				   struct kernel_sigaction *, size_t);
 
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  This is the definition.  */
-int __libc_missing_rt_sigs;
-
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
    If OACT is not NULL, put the old action for SIG in *OACT.  */
@@ -49,12 +56,18 @@ __sigaction (sig, act, oact)
   struct old_kernel_sigaction k_sigact, k_osigact;
   int result;
 
-#ifdef __NR_rt_sigaction
+#if defiend __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0
   /* First try the RT signals.  */
+# if __ASSUME_REALTIME_SIGNALS == 0
   if (!__libc_missing_rt_sigs)
+# endif
     {
       struct kernel_sigaction kact, koact;
+      /* Save the current error value for later.  We need not do this
+	 if we are guaranteed to have realtime signals.  */
+# if __ASSUME_REALTIME_SIGNALS == 0
       int saved_errno = errno;
+# endif
 
       if (act)
 	{
@@ -71,7 +84,9 @@ __sigaction (sig, act, oact)
       result = INLINE_SYSCALL (rt_sigaction, 4, sig, act ? &kact : NULL,
 			       oact ? &koact : NULL, _NSIG / 8);
 
+# if __ASSUME_REALTIME_SIGNALS == 0
       if (result >= 0 || errno != ENOSYS)
+# endif
 	{
 	  if (oact && result >= 0)
 	    {
@@ -85,19 +100,22 @@ __sigaction (sig, act, oact)
 	  return result;
 	}
 
+# if __ASSUME_REALTIME_SIGNALS == 0
       __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
+# endif
     }
 #endif
 
+#if __ASSUME_REALTIME_SIGNALS == 0
   if (act)
     {
       k_sigact.k_sa_handler = act->sa_handler;
       k_sigact.sa_mask = act->sa_mask.__val[0];
       k_sigact.sa_flags = act->sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
       k_sigact.sa_restorer = act->sa_restorer;
-#endif
+# endif
     }
   result = INLINE_SYSCALL (sigaction, 3, sig, act ? &k_sigact : NULL,
 			   oact ? &k_osigact : NULL);
@@ -106,11 +124,12 @@ __sigaction (sig, act, oact)
       oact->sa_handler = k_osigact.k_sa_handler;
       oact->sa_mask.__val[0] = k_osigact.sa_mask;
       oact->sa_flags = k_osigact.sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
       oact->sa_restorer = k_osigact.sa_restorer;
-#endif
+# endif
     }
   return result;
+#endif
 }
 
 weak_alias (__sigaction, sigaction)