diff options
Diffstat (limited to 'libc/sysdeps/linux/mips')
| -rw-r--r-- | libc/sysdeps/linux/mips/bits/signum.h | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/bits/socket.h | 1 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/sigaction.c | 52 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/syscall.S | 3 |
4 files changed, 32 insertions, 26 deletions
diff --git a/libc/sysdeps/linux/mips/bits/signum.h b/libc/sysdeps/linux/mips/bits/signum.h index a9b684834..6176b90b9 100644 --- a/libc/sysdeps/linux/mips/bits/signum.h +++ b/libc/sysdeps/linux/mips/bits/signum.h @@ -65,7 +65,7 @@ #define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ -#define _NSIG 128 /* Biggest signal number + 1 +#define _NSIG 129 /* Biggest signal number + 1 (including real-time signals). */ #define SIGRTMIN (__libc_current_sigrtmin ()) diff --git a/libc/sysdeps/linux/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h index 0860b4d38..39fadc676 100644 --- a/libc/sysdeps/linux/mips/bits/socket.h +++ b/libc/sysdeps/linux/mips/bits/socket.h @@ -270,6 +270,7 @@ struct cmsghdr extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) __THROW; +libc_hidden_proto(__cmsg_nxthdr) #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE # define _EXTERN_INLINE extern __inline diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c index edd265438..ca39740af 100644 --- a/libc/sysdeps/linux/mips/sigaction.c +++ b/libc/sysdeps/linux/mips/sigaction.c @@ -47,36 +47,42 @@ static void restore (void) __asm__ ("__restore"); If OACT is not NULL, put the old action for SIG in *OACT. */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { - int result; - struct kernel_sigaction kact, koact; - - if (act) { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); - kact.sa_flags = act->sa_flags; + int result; + struct kernel_sigaction kact, koact; + enum { + SIGSET_MIN_SIZE = sizeof(kact.sa_mask) < sizeof(act->sa_mask) + ? sizeof(kact.sa_mask) : sizeof(act->sa_mask) + }; + + if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, SIGSET_MIN_SIZE); + kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER # if _MIPS_SIM == _ABIO32 - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = act->sa_restorer; # else - kact.sa_restorer = &restore_rt; + kact.sa_restorer = &restore_rt; # endif # endif - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = __syscall_rt_sigaction(sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); - - if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); - oact->sa_flags = koact.sa_flags; + } + + /* NB: kernel (as of 2.6.25) will return EINVAL + * if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */ + result = __syscall_rt_sigaction(sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, + sizeof(kact.sa_mask)); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, SIGSET_MIN_SIZE); + oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = koact.sa_restorer; # endif - } - return result; + } + return result; } diff --git a/libc/sysdeps/linux/mips/syscall.S b/libc/sysdeps/linux/mips/syscall.S index ff6f3d1b4..acb91011d 100644 --- a/libc/sysdeps/linux/mips/syscall.S +++ b/libc/sysdeps/linux/mips/syscall.S @@ -32,7 +32,6 @@ syscall: #ifdef __PIC__ SETUP_GP #endif - .set noreorder move v0, a0 /* Load system call number from first arg. */ move a0, a1 /* Move the next three args up a register. */ move a1, a2 @@ -59,12 +58,12 @@ syscall: lw v0,7*4(sp) /* for system call restarts */ #endif syscall /* Do the system call. */ - bnez a3, 1f #ifdef __mips64 daddiu sp,sp,16 #else addiu sp,sp,32 #endif + bnez a3, 1f j ra /* Return to caller. */ 1: move a0,v0 /* Pass return val to C function. */ |
