[PATCH 2/2] Fix MIPS sigaction reporting
Chris Dearman
chris.dearman at imgtec.com
Tue Dec 10 03:58:42 UTC 2013
MIPS userland uses the same sigaction structure with a full signal
mask for old_sigaction and new_sigaction and does does not have
an sa_restorer field.
These changes have been tested on MIPS O32 big/little endian, MIPS N64
big endian and x86-64.
Signed-off-by: Chris Dearman <chris.dearman at imgtec.com>
---
signal.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/signal.c b/signal.c
index 3a11b8a..5bde8f5 100644
--- a/signal.c
+++ b/signal.c
@@ -673,6 +673,15 @@ sys_sigsetmask(struct tcb *tcp)
#ifdef HAVE_SIGACTION
+#if defined(MIPS)
+struct old_sigaction {
+ unsigned int sa_flags;
+ /* sa_handler may be a libc #define, need to use other name: */
+ void (*__sa_handler)(int);
+ /* Kernel treats sa_mask as an array of longs. */
+ unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
+};
+#else
struct old_sigaction {
/* sa_handler may be a libc #define, need to use other name: */
void (*__sa_handler)(int);
@@ -680,6 +689,7 @@ struct old_sigaction {
unsigned long sa_flags;
void (*sa_restorer)(void);
};
+#endif
int
sys_sigaction(struct tcb *tcp)
@@ -716,7 +726,11 @@ sys_sigaction(struct tcb *tcp)
tprints("{SIG_IGN, ");
else
tprintf("{%#lx, ", (long) sa.__sa_handler);
+#ifdef MIPS
+ tprints(sprintsigmask("", (sigset_t *)sa.sa_mask));
+#else
tprints(sprintsigmask_long("", sa.sa_mask));
+#endif
tprints(", ");
printflags(sigact_flags, sa.sa_flags, "SA_???");
#ifdef SA_RESTORER
@@ -727,8 +741,10 @@ sys_sigaction(struct tcb *tcp)
}
if (entering(tcp))
tprints(", ");
+#ifdef SA_RESTORER
else
tprintf(", %#lx", (unsigned long) sa.sa_restorer);
+#endif
return 0;
}
@@ -1207,6 +1223,16 @@ sys_rt_sigprocmask(struct tcb *tcp)
}
/* Structure describing the action to be taken when a signal arrives. */
+#if defined(MIPS)
+struct new_sigaction
+{
+ unsigned int sa_flags;
+ /* sa_handler may be a libc #define, need to use other name: */
+ void (*__sa_handler)(int);
+ /* Kernel treats sa_mask as an array of longs. */
+ unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
+};
+#else
struct new_sigaction
{
/* sa_handler may be a libc #define, need to use other name: */
@@ -1224,6 +1250,7 @@ struct new_sigaction32
uint32_t sa_restorer;
uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
};
+#endif
int
sys_rt_sigaction(struct tcb *tcp)
--
1.8.3.4.837.g0bde8c0
More information about the Strace-devel
mailing list