Merge "POSIX says sigaction::sa_flags is int."

This commit is contained in:
Elliott Hughes 2017-12-16 00:02:53 +00:00 committed by Gerrit Code Review
commit 5e77d57c48
2 changed files with 20 additions and 20 deletions

View file

@ -37,17 +37,13 @@
#include <bits/timespec.h> #include <bits/timespec.h>
#include <limits.h> #include <limits.h>
#if defined(__LP64__) || defined(__mips__) /* For 64-bit (and mips), the kernel's struct sigaction doesn't match the
/* For 64-bit (and mips), the kernel's struct sigaction doesn't match the POSIX one, * 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. */ * For 32-bit, we're stuck with the definitions we already shipped,
# define sigaction __kernel_sigaction
# include <linux/signal.h>
# undef sigaction
#else
/* 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. */
# include <linux/signal.h> #define sigaction __kernel_sigaction
#endif #include <linux/signal.h>
#undef sigaction
#include <sys/ucontext.h> #include <sys/ucontext.h>
#define __BIONIC_HAVE_UCONTEXT_T #define __BIONIC_HAVE_UCONTEXT_T
@ -87,7 +83,7 @@ typedef __sighandler_t sighandler_t; /* glibc compatibility. */
#if defined(__LP64__) #if defined(__LP64__)
struct sigaction { struct sigaction {
unsigned int sa_flags; int sa_flags;
union { union {
sighandler_t sa_handler; sighandler_t sa_handler;
void (*sa_sigaction)(int, struct siginfo*, void*); void (*sa_sigaction)(int, struct siginfo*, void*);
@ -99,7 +95,7 @@ struct sigaction {
#elif defined(__mips__) #elif defined(__mips__)
struct sigaction { struct sigaction {
unsigned int sa_flags; int sa_flags;
union { union {
sighandler_t sa_handler; sighandler_t sa_handler;
void (*sa_sigaction) (int, struct siginfo*, void*); void (*sa_sigaction) (int, struct siginfo*, void*);
@ -107,6 +103,18 @@ struct sigaction {
sigset_t sa_mask; sigset_t sa_mask;
}; };
#else
struct sigaction {
union {
sighandler_t _sa_handler;
void (*_sa_sigaction)(int, struct siginfo*, void*);
} _u;
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
#endif #endif
int sigaction(int __signal, const struct sigaction* __new_action, struct sigaction* __old_action); int sigaction(int __signal, const struct sigaction* __new_action, struct sigaction* __old_action);

View file

@ -103,15 +103,7 @@ static void signal_h() {
TYPE(struct sigaction); TYPE(struct sigaction);
STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int), sa_handler); STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int), sa_handler);
STRUCT_MEMBER(struct sigaction, sigset_t, sa_mask); STRUCT_MEMBER(struct sigaction, sigset_t, sa_mask);
#if defined(__BIONIC__)
#if defined(__LP64__)
STRUCT_MEMBER(struct sigaction, unsigned int, sa_flags); // TODO: easily fixed!
#else
STRUCT_MEMBER(struct sigaction, unsigned long, sa_flags);
#endif
#else
STRUCT_MEMBER(struct sigaction, int, sa_flags); STRUCT_MEMBER(struct sigaction, int, sa_flags);
#endif
STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int, siginfo_t*, void*), sa_sigaction); STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int, siginfo_t*, void*), sa_sigaction);
i = SIG_BLOCK; i = SIG_BLOCK;