Merge "Fix <signal.h> for mips uapi."

This commit is contained in:
Elliott Hughes 2013-11-20 20:54:03 +00:00 committed by Gerrit Code Review
commit 39bc7ecd45
1 changed files with 20 additions and 12 deletions

View File

@ -35,8 +35,8 @@
#include <string.h> /* For memset() */ #include <string.h> /* For memset() */
#include <sys/types.h> #include <sys/types.h>
#if defined(__LP64__) #if defined(__LP64__) || defined(__mips__)
/* For 64-bit, the kernel's struct sigaction doesn't match the POSIX one, /* 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. */ * so we need to expose our own and translate behind the scenes. */
# define sigaction __kernel_sigaction # define sigaction __kernel_sigaction
# include <linux/signal.h> # include <linux/signal.h>
@ -44,7 +44,7 @@
#else #else
/* For 32-bit, we're stuck with the definitions we already shipped, /* For 32-bit, we're stuck with the definitions we already shipped,
* even though they contain a sigset_t that's too small. */ * 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> # include <linux/signal.h>
# undef __ARCH_SI_UID_T # undef __ARCH_SI_UID_T
#endif #endif
@ -53,15 +53,12 @@ __BEGIN_DECLS
typedef int sig_atomic_t; typedef int sig_atomic_t;
/* _NSIG is used by the SIGRTMAX definition under <asm/signal.h>, however /* TODO: 64-bit: we should probably #undef the uapi NSIG and add a unit test that NSIG == _NSIG && NSIG >= 64. */
* 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.
*/
#ifndef _NSIG #ifndef _NSIG
# define _NSIG 64 # define _NSIG 64
#endif
#ifndef NSIG
# define NSIG _NSIG
#endif #endif
extern const char* const sys_siglist[]; 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 sig_t; /* BSD compatibility. */
typedef __sighandler_t sighandler_t; /* glibc compatibility. */ typedef __sighandler_t sighandler_t; /* glibc compatibility. */
#if __LP64__ #if defined(__LP64__)
struct sigaction { struct sigaction {
unsigned int sa_flags; unsigned int sa_flags;
@ -82,6 +79,17 @@ struct sigaction {
void (*sa_restorer)(void); 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 #endif
extern int sigaction(int, const struct sigaction*, struct sigaction*); extern int sigaction(int, const struct sigaction*, struct sigaction*);