summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-11-20 12:51:52 -0800
committerElliott Hughes <enh@google.com>2013-11-20 12:51:52 -0800
commitd8482b6c7eae54c37bc769030d60c2a5af187f89 (patch)
tree4d695b20c87260f10c18b57ef033209759a5ec96
parentdb1dec1ed4fac8bdb312a53e63ba8afeb3c9dea3 (diff)
downloadbionic-d8482b6c7eae54c37bc769030d60c2a5af187f89.zip
bionic-d8482b6c7eae54c37bc769030d60c2a5af187f89.tar.gz
bionic-d8482b6c7eae54c37bc769030d60c2a5af187f89.tar.bz2
Fix <signal.h> for mips uapi.
Bug: 11559337 Change-Id: I4c6080f162d74ee78c81d698c7b50470b0e09586
-rw-r--r--libc/include/signal.h32
1 files changed, 20 insertions, 12 deletions
diff --git a/libc/include/signal.h b/libc/include/signal.h
index fe2c586..e326ddb 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -35,8 +35,8 @@
#include <string.h> /* For memset() */
#include <sys/types.h>
-#if defined(__LP64__)
-/* For 64-bit, the kernel's struct sigaction doesn't match the POSIX one,
+#if defined(__LP64__) || defined(__mips__)
+/* For 64-bit (and mips), the kernel's struct sigaction doesn't match the POSIX one,
* so we need to expose our own and translate behind the scenes. */
# define sigaction __kernel_sigaction
# include <linux/signal.h>
@@ -44,7 +44,7 @@
#else
/* For 32-bit, we're stuck with the definitions we already shipped,
* even though they contain a sigset_t that's too small. */
-# define __ARCH_SI_UID_T __kernel_uid32_t /* TODO: remove this when we switch to uapi. */
+# define __ARCH_SI_UID_T __kernel_uid32_t /* TODO: 64-bit: remove this when we've switch 32-bit to uapi too. */
# include <linux/signal.h>
# undef __ARCH_SI_UID_T
#endif
@@ -53,15 +53,12 @@ __BEGIN_DECLS
typedef int sig_atomic_t;
-/* _NSIG is used by the SIGRTMAX definition under <asm/signal.h>, however
- * its definition is part of a #if __KERNEL__ .. #endif block in the original
- * kernel headers and is thus not part of our cleaned-up versions.
- *
- * Looking at the current kernel sources, it is defined as 64 for all
- * architectures except for the 'mips' one which set it to 128.
- */
+/* TODO: 64-bit: we should probably #undef the uapi NSIG and add a unit test that NSIG == _NSIG && NSIG >= 64. */
#ifndef _NSIG
-# define _NSIG 64
+# define _NSIG 64
+#endif
+#ifndef NSIG
+# define NSIG _NSIG
#endif
extern const char* const sys_siglist[];
@@ -70,7 +67,7 @@ extern const char* const sys_signame[];
typedef __sighandler_t sig_t; /* BSD compatibility. */
typedef __sighandler_t sighandler_t; /* glibc compatibility. */
-#if __LP64__
+#if defined(__LP64__)
struct sigaction {
unsigned int sa_flags;
@@ -82,6 +79,17 @@ struct sigaction {
void (*sa_restorer)(void);
};
+#elif defined(__mips__)
+
+struct sigaction {
+ unsigned int sa_flags;
+ union {
+ sighandler_t sa_handler;
+ void (*sa_sigaction) (int, struct siginfo*, void*);
+ };
+ sigset_t sa_mask;
+};
+
#endif
extern int sigaction(int, const struct sigaction*, struct sigaction*);