am 516b26f2: am 0837c69a: am edf09bf9: am 316ee626: Merge "MIPS support to sigsuspend and sigwait routines"
* commit '516b26f2bf755879feb51d06dcd9511903d0a9bd':
MIPS support to sigsuspend and sigwait routines
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 8f78e7f..6f12be8 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -216,7 +216,8 @@
# signals
int sigaction(int, const struct sigaction *, struct sigaction *) 67
int sigprocmask(int, const sigset_t *, sigset_t *) 126
-int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72
+int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72,72,-1
+int __sigsuspend:sigsuspend(const sigset_t *mask) -1,-1,72
int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174,174,194
int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175,175,195
int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177,177,197
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index c33dc9f..48564cd 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -47,7 +47,6 @@
#define __NR_getppid (__NR_SYSCALL_BASE + 64)
#define __NR_setsid (__NR_SYSCALL_BASE + 66)
#define __NR_sigaction (__NR_SYSCALL_BASE + 67)
-#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72)
#define __NR_sigpending (__NR_SYSCALL_BASE + 73)
#define __NR_setrlimit (__NR_SYSCALL_BASE + 75)
#define __NR_getrusage (__NR_SYSCALL_BASE + 77)
@@ -168,6 +167,7 @@
#define __NR_timer_delete (__NR_SYSCALL_BASE + 261)
#define __NR_utimes (__NR_SYSCALL_BASE + 269)
#define __NR_utimensat (__NR_SYSCALL_BASE + 348)
+#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72)
#define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174)
#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175)
#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE + 177)
@@ -216,6 +216,7 @@
#define __NR_waitpid (__NR_SYSCALL_BASE + 7)
#define __NR_kill (__NR_SYSCALL_BASE + 37)
#define __NR_pipe (__NR_SYSCALL_BASE + 42)
+#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72)
#define __NR_socketcall (__NR_SYSCALL_BASE + 102)
#define __NR_fdatasync (__NR_SYSCALL_BASE + 148)
#define __NR_mlock (__NR_SYSCALL_BASE + 150)
@@ -339,6 +340,7 @@
#define __NR_getegid (__NR_SYSCALL_BASE + 50)
#define __NR_setreuid (__NR_SYSCALL_BASE + 70)
#define __NR_setregid (__NR_SYSCALL_BASE + 71)
+#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72)
#define __NR_getrlimit (__NR_SYSCALL_BASE + 76)
#define __NR_getgroups (__NR_SYSCALL_BASE + 80)
#define __NR_setgroups (__NR_SYSCALL_BASE + 81)
diff --git a/libc/unistd/sigsuspend.c b/libc/unistd/sigsuspend.c
index 0db05ed..fd08631 100644
--- a/libc/unistd/sigsuspend.c
+++ b/libc/unistd/sigsuspend.c
@@ -26,12 +26,18 @@
* SUCH DAMAGE.
*/
#include <signal.h>
-
+#ifdef __mips__
+extern int __sigsuspend(const sigset_t *);
+#else
extern int __sigsuspend(int, int, unsigned int);
+#endif
int sigsuspend(const sigset_t *_mask)
{
- unsigned int mask = (unsigned int)*_mask;
-
- return __sigsuspend(0, 0, mask);
+#ifdef __mips__
+ return __sigsuspend(_mask);
+#else
+ unsigned int mask = (unsigned int)*_mask;
+ return __sigsuspend(0, 0, mask);
+#endif
}
diff --git a/libc/unistd/sigwait.c b/libc/unistd/sigwait.c
index c9c2a54..1e90c41 100644
--- a/libc/unistd/sigwait.c
+++ b/libc/unistd/sigwait.c
@@ -47,6 +47,14 @@
int sigwait(const sigset_t *set, int *sig)
{
int ret;
+#ifdef __mips__
+ /* use a union to get rid of aliasing warnings. On MIPS sigset_t is 128 bits */
+ union {
+ sigset_t kernel_sigset;
+ sigset_t dummy_sigset;
+ } u;
+ u.dummy_sigset = *set;
+#else
/* use a union to get rid of aliasing warnings */
union {
unsigned long kernel_sigset[2];
@@ -55,6 +63,7 @@
u.kernel_sigset[0] = *set;
u.kernel_sigset[1] = 0; /* no real-time signals supported ? */
+#endif
for (;;)
{
/* __rt_sigtimedwait can return EAGAIN or EINTR, we need to loop