From: Elliott Hughes Date: Wed, 20 Nov 2013 20:51:52 +0000 (-0800) Subject: Fix for mips uapi. X-Git-Tag: android-x86-7.1-r1~757^2~1541^2~9^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d8482b6c7eae54c37bc769030d60c2a5af187f89;p=android-x86%2Fbionic.git Fix for mips uapi. Bug: 11559337 Change-Id: I4c6080f162d74ee78c81d698c7b50470b0e09586 --- diff --git a/libc/include/signal.h b/libc/include/signal.h index fe2c58635..e326ddb1a 100644 --- a/libc/include/signal.h +++ b/libc/include/signal.h @@ -35,8 +35,8 @@ #include /* For memset() */ #include -#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 @@ -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 # 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 , 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*);