mips: fix sigaction reporting

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.

* signal.c (old_sigaction) [MIPS]: Add definition for MIPS.
(decode_old_sigaction) [MIPS]: Print sa_mask according to its definition.
(new_sigaction) [MIPS]: Add definition for MIPS.

Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
diff --git a/signal.c b/signal.c
index 2abb196..9a7e47f 100644
--- a/signal.c
+++ b/signal.c
@@ -669,10 +669,17 @@
 
 struct old_sigaction {
 	/* sa_handler may be a libc #define, need to use other name: */
+#ifdef MIPS
+	unsigned int sa_flags;
+	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
 	void (*__sa_handler)(int);
 	unsigned long sa_mask;
 	unsigned long sa_flags;
 	void (*sa_restorer)(void);
+#endif /* !MIPS */
 };
 
 static void
@@ -709,7 +716,11 @@
 		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
@@ -1210,9 +1221,14 @@
 struct new_sigaction
 {
 	/* sa_handler may be a libc #define, need to use other name: */
+#ifdef MIPS
+	unsigned int sa_flags;
+	void (*__sa_handler)(int);
+#else
 	void (*__sa_handler)(int);
 	unsigned long sa_flags;
 	void (*sa_restorer)(void);
+#endif /* !MIPS */
 	/* Kernel treats sa_mask as an array of longs. */
 	unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
 };