summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/mips/sigaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/mips/sigaction.c')
-rw-r--r--libc/sysdeps/linux/mips/sigaction.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c
index 79bbdae5e..4cbdc7023 100644
--- a/libc/sysdeps/linux/mips/sigaction.c
+++ b/libc/sysdeps/linux/mips/sigaction.c
@@ -25,10 +25,10 @@
#include <sys/syscall.h>
#include <bits/kernel_sigaction.h>
-#define SA_RESTORER 0x04000000
-
#if defined __NR_rt_sigaction
+#warning "Yes there is a warning here. Don't worry about it."
+static void restore_rt (void) asm ("__restore_rt");
/* 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. */
@@ -37,22 +37,17 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
int result;
struct kernel_sigaction kact, koact;
-#ifdef SIGCANCEL
- if (sig == SIGCANCEL) {
- __set_errno (EINVAL);
- return -1;
- }
-#endif
-
if (act) {
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
kact.sa_flags = act->sa_flags;
-
- kact.sa_flags = act->sa_flags | SA_RESTORER;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
+# if _MIPS_SIM == _ABIO32
kact.sa_restorer = act->sa_restorer;
-#endif
+# else
+ kact.sa_restorer = &restore_rt;
+# endif
+# endif
}
/* XXX The size argument hopefully will have to be changed to the
@@ -64,9 +59,9 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
oact->sa_flags = koact.sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
oact->sa_restorer = koact.sa_restorer;
-#endif
+# endif
}
return result;
}
@@ -83,20 +78,17 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
int result;
struct old_kernel_sigaction kact, koact;
-#ifdef SIGCANCEL
- if (sig == SIGCANCEL) {
- __set_errno (EINVAL);
- return -1;
- }
-#endif
-
if (act) {
kact.k_sa_handler = act->sa_handler;
kact.sa_mask = act->sa_mask.__val[0];
- kact.sa_flags = act->sa_flags | SA_RESTORER;
-#ifdef HAVE_SA_RESTORER
+ kact.sa_flags = act->sa_flags;
+# ifdef HAVE_SA_RESTORER
+# if _MIPS_SIM == _ABIO32
kact.sa_restorer = act->sa_restorer;
-#endif
+# else
+ kact.sa_restorer = &restore_rt;
+# endif
+# endif
}
result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL,
@@ -111,13 +103,15 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
oact->sa_handler = koact.k_sa_handler;
oact->sa_mask.__val[0] = koact.sa_mask;
oact->sa_flags = koact.sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
oact->sa_restorer = koact.sa_restorer;
-#endif
+# endif
}
return result;
}
#endif
-weak_alias (__libc_sigaction, sigaction)
+#ifndef LIBC_SIGACTION
+weak_alias (__libc_sigaction, sigaction)
+#endif