2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000, 2006 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 #include <linux/cache.h>
11 #include <linux/sched.h>
13 #include <linux/smp.h>
14 #include <linux/smp_lock.h>
15 #include <linux/kernel.h>
16 #include <linux/signal.h>
17 #include <linux/syscalls.h>
18 #include <linux/errno.h>
19 #include <linux/wait.h>
20 #include <linux/ptrace.h>
21 #include <linux/compat.h>
22 #include <linux/suspend.h>
23 #include <linux/compiler.h>
27 #include <linux/bitops.h>
28 #include <asm/cacheflush.h>
30 #include <asm/uaccess.h>
31 #include <asm/ucontext.h>
32 #include <asm/system.h>
36 #include "signal-common.h"
38 #define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
40 typedef struct compat_siginfo {
46 int _pad[SI_PAD_SIZE32];
50 compat_pid_t _pid; /* sender's pid */
51 compat_uid_t _uid; /* sender's uid */
56 compat_pid_t _pid; /* which child */
57 compat_uid_t _uid; /* sender's uid */
58 int _status; /* exit code */
59 compat_clock_t _utime;
60 compat_clock_t _stime;
65 compat_pid_t _pid; /* which child */
66 compat_clock_t _utime;
67 int _status; /* exit code */
68 compat_clock_t _stime;
71 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
73 s32 _addr; /* faulting insn/memory ref. */
76 /* SIGPOLL, SIGXFSZ (To do ...) */
78 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
84 timer_t _tid; /* timer id */
85 int _overrun; /* overrun count */
86 compat_sigval_t _sigval;/* same as below */
87 int _sys_private; /* not to be passed to user */
90 /* POSIX.1b signals */
92 compat_pid_t _pid; /* sender's pid */
93 compat_uid_t _uid; /* sender's uid */
94 compat_sigval_t _sigval;
101 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
103 #define __NR_O32_sigreturn 4119
104 #define __NR_O32_rt_sigreturn 4193
105 #define __NR_O32_restart_syscall 4253
107 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
109 /* 32-bit compatibility types */
111 #define _NSIG_BPW32 32
112 #define _NSIG_WORDS32 (_NSIG / _NSIG_BPW32)
115 unsigned int sig[_NSIG_WORDS32];
118 typedef unsigned int __sighandler32_t;
119 typedef void (*vfptr_t)(void);
122 unsigned int sa_flags;
123 __sighandler32_t sa_handler;
124 compat_sigset_t sa_mask;
127 /* IRIX compatible stack_t */
128 typedef struct sigaltstack32 {
130 compat_size_t ss_size;
138 struct sigcontext32 uc_mcontext;
139 sigset_t32 uc_sigmask; /* mask last for extensibility */
142 #if ICACHE_REFILLS_WORKAROUND_WAR == 0
144 struct rt_sigframe32 {
145 u32 rs_ass[4]; /* argument save space for o32 */
146 u32 rs_code[2]; /* signal trampoline */
147 compat_siginfo_t rs_info;
148 struct ucontext32 rs_uc;
151 #else /* ICACHE_REFILLS_WORKAROUND_WAR */
153 struct rt_sigframe32 {
154 u32 rs_ass[4]; /* argument save space for o32 */
156 compat_siginfo_t rs_info;
157 struct ucontext32 rs_uc;
158 u32 rs_code[8] __attribute__((aligned(32))); /* signal trampoline */
161 #endif /* !ICACHE_REFILLS_WORKAROUND_WAR */
164 * sigcontext handlers
166 static int setup_sigcontext32(struct pt_regs *regs,
167 struct sigcontext32 __user *sc)
172 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
174 err |= __put_user(0, &sc->sc_regs[0]);
175 for (i = 1; i < 32; i++)
176 err |= __put_user(regs->regs[i], &sc->sc_regs[i]);
178 err |= __put_user(regs->hi, &sc->sc_mdhi);
179 err |= __put_user(regs->lo, &sc->sc_mdlo);
181 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
182 err |= __put_user(mfhi1(), &sc->sc_hi1);
183 err |= __put_user(mflo1(), &sc->sc_lo1);
184 err |= __put_user(mfhi2(), &sc->sc_hi2);
185 err |= __put_user(mflo2(), &sc->sc_lo2);
186 err |= __put_user(mfhi3(), &sc->sc_hi3);
187 err |= __put_user(mflo3(), &sc->sc_lo3);
190 err |= __put_user(!!used_math(), &sc->sc_used_math);
194 * Save FPU state to signal context. Signal handler
195 * will "inherit" current FPU state.
199 if (!is_fpu_owner()) {
203 err |= save_fp_context32(sc);
210 static int restore_sigcontext32(struct pt_regs *regs,
211 struct sigcontext32 __user *sc)
218 /* Always make any pending restarted system calls return -EINTR */
219 current_thread_info()->restart_block.fn = do_no_restart_syscall;
221 err |= __get_user(regs->cp0_epc, &sc->sc_pc);
222 err |= __get_user(regs->hi, &sc->sc_mdhi);
223 err |= __get_user(regs->lo, &sc->sc_mdlo);
225 err |= __get_user(treg, &sc->sc_hi1); mthi1(treg);
226 err |= __get_user(treg, &sc->sc_lo1); mtlo1(treg);
227 err |= __get_user(treg, &sc->sc_hi2); mthi2(treg);
228 err |= __get_user(treg, &sc->sc_lo2); mtlo2(treg);
229 err |= __get_user(treg, &sc->sc_hi3); mthi3(treg);
230 err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg);
231 err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
234 for (i = 1; i < 32; i++)
235 err |= __get_user(regs->regs[i], &sc->sc_regs[i]);
237 err |= __get_user(used_math, &sc->sc_used_math);
238 conditional_used_math(used_math);
243 /* restore fpu context if we have used it before */
245 err |= restore_fp_context32(sc);
247 /* signal handler may have used FPU. Give it up. */
259 extern void __put_sigset_unknown_nsig(void);
260 extern void __get_sigset_unknown_nsig(void);
262 static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
266 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(*ubuf)))
269 switch (_NSIG_WORDS) {
271 __put_sigset_unknown_nsig();
273 err |= __put_user (kbuf->sig[1] >> 32, &ubuf->sig[3]);
274 err |= __put_user (kbuf->sig[1] & 0xffffffff, &ubuf->sig[2]);
276 err |= __put_user (kbuf->sig[0] >> 32, &ubuf->sig[1]);
277 err |= __put_user (kbuf->sig[0] & 0xffffffff, &ubuf->sig[0]);
283 static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf)
286 unsigned long sig[4];
288 if (!access_ok(VERIFY_READ, ubuf, sizeof(*ubuf)))
291 switch (_NSIG_WORDS) {
293 __get_sigset_unknown_nsig();
295 err |= __get_user (sig[3], &ubuf->sig[3]);
296 err |= __get_user (sig[2], &ubuf->sig[2]);
297 kbuf->sig[1] = sig[2] | (sig[3] << 32);
299 err |= __get_user (sig[1], &ubuf->sig[1]);
300 err |= __get_user (sig[0], &ubuf->sig[0]);
301 kbuf->sig[0] = sig[0] | (sig[1] << 32);
308 * Atomically swap in the new signal mask, and wait for a signal.
311 asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
313 compat_sigset_t __user *uset;
316 uset = (compat_sigset_t __user *) regs.regs[4];
317 if (get_sigset(&newset, uset))
319 sigdelsetmask(&newset, ~_BLOCKABLE);
321 spin_lock_irq(¤t->sighand->siglock);
322 current->saved_sigmask = current->blocked;
323 current->blocked = newset;
325 spin_unlock_irq(¤t->sighand->siglock);
327 current->state = TASK_INTERRUPTIBLE;
329 set_thread_flag(TIF_RESTORE_SIGMASK);
330 return -ERESTARTNOHAND;
333 asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
335 compat_sigset_t __user *uset;
339 /* XXX Don't preclude handling different sized sigset_t's. */
340 sigsetsize = regs.regs[5];
341 if (sigsetsize != sizeof(compat_sigset_t))
344 uset = (compat_sigset_t __user *) regs.regs[4];
345 if (get_sigset(&newset, uset))
347 sigdelsetmask(&newset, ~_BLOCKABLE);
349 spin_lock_irq(¤t->sighand->siglock);
350 current->saved_sigmask = current->blocked;
351 current->blocked = newset;
353 spin_unlock_irq(¤t->sighand->siglock);
355 current->state = TASK_INTERRUPTIBLE;
357 set_thread_flag(TIF_RESTORE_SIGMASK);
358 return -ERESTARTNOHAND;
361 asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act,
362 struct sigaction32 __user *oact)
364 struct k_sigaction new_ka, old_ka;
372 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
374 err |= __get_user(handler, &act->sa_handler);
375 new_ka.sa.sa_handler = (void __user *)(s64)handler;
376 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
377 err |= __get_user(mask, &act->sa_mask.sig[0]);
381 siginitset(&new_ka.sa.sa_mask, mask);
384 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
387 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
389 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
390 err |= __put_user((u32)(u64)old_ka.sa.sa_handler,
392 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
393 err |= __put_user(0, &oact->sa_mask.sig[1]);
394 err |= __put_user(0, &oact->sa_mask.sig[2]);
395 err |= __put_user(0, &oact->sa_mask.sig[3]);
403 asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
405 const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4];
406 stack32_t __user *uoss = (stack32_t __user *) regs.regs[5];
407 unsigned long usp = regs.regs[29];
410 mm_segment_t old_fs = get_fs();
414 if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
416 err |= __get_user(sp, &uss->ss_sp);
417 kss.ss_sp = (void __user *) (long) sp;
418 err |= __get_user(kss.ss_size, &uss->ss_size);
419 err |= __get_user(kss.ss_flags, &uss->ss_flags);
425 ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL,
426 uoss ? (stack_t __user *)&koss : NULL, usp);
430 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
432 sp = (int) (unsigned long) koss.ss_sp;
433 err |= __put_user(sp, &uoss->ss_sp);
434 err |= __put_user(koss.ss_size, &uoss->ss_size);
435 err |= __put_user(koss.ss_flags, &uoss->ss_flags);
442 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
446 if (!access_ok (VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
449 /* If you change siginfo_t structure, please be sure
450 this code is fixed accordingly.
451 It should never copy any pad contained in the structure
452 to avoid security leaks, but must copy the generic
453 3 ints plus the relevant union member.
454 This routine must convert siginfo from 64bit to 32bit as well
456 err = __put_user(from->si_signo, &to->si_signo);
457 err |= __put_user(from->si_errno, &to->si_errno);
458 err |= __put_user((short)from->si_code, &to->si_code);
459 if (from->si_code < 0)
460 err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
462 switch (from->si_code >> 16) {
463 case __SI_TIMER >> 16:
464 err |= __put_user(from->si_tid, &to->si_tid);
465 err |= __put_user(from->si_overrun, &to->si_overrun);
466 err |= __put_user(from->si_int, &to->si_int);
468 case __SI_CHLD >> 16:
469 err |= __put_user(from->si_utime, &to->si_utime);
470 err |= __put_user(from->si_stime, &to->si_stime);
471 err |= __put_user(from->si_status, &to->si_status);
473 err |= __put_user(from->si_pid, &to->si_pid);
474 err |= __put_user(from->si_uid, &to->si_uid);
476 case __SI_FAULT >> 16:
477 err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
479 case __SI_POLL >> 16:
480 err |= __put_user(from->si_band, &to->si_band);
481 err |= __put_user(from->si_fd, &to->si_fd);
483 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
484 case __SI_MESGQ >> 16:
485 err |= __put_user(from->si_pid, &to->si_pid);
486 err |= __put_user(from->si_uid, &to->si_uid);
487 err |= __put_user(from->si_int, &to->si_int);
494 asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
496 struct sigframe __user *frame;
499 frame = (struct sigframe __user *) regs.regs[29];
500 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
502 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
505 sigdelsetmask(&blocked, ~_BLOCKABLE);
506 spin_lock_irq(¤t->sighand->siglock);
507 current->blocked = blocked;
509 spin_unlock_irq(¤t->sighand->siglock);
511 if (restore_sigcontext32(®s, &frame->sf_sc))
515 * Don't let your children do this ...
517 __asm__ __volatile__(
525 force_sig(SIGSEGV, current);
528 asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
530 struct rt_sigframe32 __user *frame;
536 frame = (struct rt_sigframe32 __user *) regs.regs[29];
537 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
539 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
542 sigdelsetmask(&set, ~_BLOCKABLE);
543 spin_lock_irq(¤t->sighand->siglock);
544 current->blocked = set;
546 spin_unlock_irq(¤t->sighand->siglock);
548 if (restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext))
551 /* The ucontext contains a stack32_t, so we must convert! */
552 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
554 st.ss_sp = (void __user *)(long) sp;
555 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
557 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
560 /* It is more difficult to avoid calling this function than to
561 call it and ignore errors. */
564 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
568 * Don't let your children do this ...
570 __asm__ __volatile__(
578 force_sig(SIGSEGV, current);
581 int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
582 int signr, sigset_t *set)
584 struct sigframe __user *frame;
587 frame = get_sigframe(ka, regs, sizeof(*frame));
588 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
591 err |= install_sigtramp(frame->sf_code, __NR_O32_sigreturn);
593 err |= setup_sigcontext32(regs, &frame->sf_sc);
594 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
599 * Arguments to signal handler:
602 * a1 = 0 (should be cause)
603 * a2 = pointer to struct sigcontext
605 * $25 and c0_epc point to the signal handler, $29 points to the
608 regs->regs[ 4] = signr;
610 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
611 regs->regs[29] = (unsigned long) frame;
612 regs->regs[31] = (unsigned long) frame->sf_code;
613 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
615 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
616 current->comm, current->pid,
617 frame, regs->cp0_epc, regs->regs[31]);
622 force_sigsegv(signr, current);
626 int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
627 int signr, sigset_t *set, siginfo_t *info)
629 struct rt_sigframe32 __user *frame;
633 frame = get_sigframe(ka, regs, sizeof(*frame));
634 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
637 err |= install_sigtramp(frame->rs_code, __NR_O32_rt_sigreturn);
639 /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */
640 err |= copy_siginfo_to_user32(&frame->rs_info, info);
642 /* Create the ucontext. */
643 err |= __put_user(0, &frame->rs_uc.uc_flags);
644 err |= __put_user(0, &frame->rs_uc.uc_link);
645 sp = (int) (long) current->sas_ss_sp;
646 err |= __put_user(sp,
647 &frame->rs_uc.uc_stack.ss_sp);
648 err |= __put_user(sas_ss_flags(regs->regs[29]),
649 &frame->rs_uc.uc_stack.ss_flags);
650 err |= __put_user(current->sas_ss_size,
651 &frame->rs_uc.uc_stack.ss_size);
652 err |= setup_sigcontext32(regs, &frame->rs_uc.uc_mcontext);
653 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
659 * Arguments to signal handler:
662 * a1 = 0 (should be cause)
663 * a2 = pointer to ucontext
665 * $25 and c0_epc point to the signal handler, $29 points to
666 * the struct rt_sigframe32.
668 regs->regs[ 4] = signr;
669 regs->regs[ 5] = (unsigned long) &frame->rs_info;
670 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
671 regs->regs[29] = (unsigned long) frame;
672 regs->regs[31] = (unsigned long) frame->rs_code;
673 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
675 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
676 current->comm, current->pid,
677 frame, regs->cp0_epc, regs->regs[31]);
682 force_sigsegv(signr, current);
686 static inline int handle_signal(unsigned long sig, siginfo_t *info,
687 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs)
691 switch (regs->regs[0]) {
692 case ERESTART_RESTARTBLOCK:
694 regs->regs[2] = EINTR;
697 if (!(ka->sa.sa_flags & SA_RESTART)) {
698 regs->regs[2] = EINTR;
702 case ERESTARTNOINTR: /* Userland will reload $v0. */
703 regs->regs[7] = regs->regs[26];
707 regs->regs[0] = 0; /* Don't deal with this again. */
709 if (ka->sa.sa_flags & SA_SIGINFO)
710 ret = current->thread.abi->setup_rt_frame(ka, regs, sig, oldset, info);
712 ret = current->thread.abi->setup_frame(ka, regs, sig, oldset);
714 spin_lock_irq(¤t->sighand->siglock);
715 sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
716 if (!(ka->sa.sa_flags & SA_NODEFER))
717 sigaddset(¤t->blocked,sig);
719 spin_unlock_irq(¤t->sighand->siglock);
724 void do_signal32(struct pt_regs *regs)
726 struct k_sigaction ka;
732 * We want the common case to go fast, which is why we may in certain
733 * cases get here from kernel mode. Just return without doing anything
736 if (!user_mode(regs))
739 if (test_thread_flag(TIF_RESTORE_SIGMASK))
740 oldset = ¤t->saved_sigmask;
742 oldset = ¤t->blocked;
744 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
746 /* Whee! Actually deliver the signal. */
747 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
749 * A signal was successfully delivered; the saved
750 * sigmask will have been stored in the signal frame,
751 * and will be restored by sigreturn, so we can simply
752 * clear the TIF_RESTORE_SIGMASK flag.
754 if (test_thread_flag(TIF_RESTORE_SIGMASK))
755 clear_thread_flag(TIF_RESTORE_SIGMASK);
762 * Who's code doesn't conform to the restartable syscall convention
763 * dies here!!! The li instruction, a single machine instruction,
764 * must directly be followed by the syscall instruction.
767 if (regs->regs[2] == ERESTARTNOHAND ||
768 regs->regs[2] == ERESTARTSYS ||
769 regs->regs[2] == ERESTARTNOINTR) {
770 regs->regs[7] = regs->regs[26];
773 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
774 regs->regs[2] = __NR_O32_restart_syscall;
775 regs->regs[7] = regs->regs[26];
778 regs->regs[0] = 0; /* Don't deal with this again. */
782 * If there's no signal to deliver, we just put the saved sigmask
785 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
786 clear_thread_flag(TIF_RESTORE_SIGMASK);
787 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL);
791 asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
792 struct sigaction32 __user *oact,
793 unsigned int sigsetsize)
795 struct k_sigaction new_sa, old_sa;
798 /* XXX: Don't preclude handling different sized sigset_t's. */
799 if (sigsetsize != sizeof(sigset_t))
806 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
808 err |= __get_user(handler, &act->sa_handler);
809 new_sa.sa.sa_handler = (void __user *)(s64)handler;
810 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
811 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
816 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
821 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
824 err |= __put_user((u32)(u64)old_sa.sa.sa_handler,
826 err |= __put_user(old_sa.sa.sa_flags, &oact->sa_flags);
827 err |= put_sigset(&old_sa.sa.sa_mask, &oact->sa_mask);
835 asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
836 compat_sigset_t __user *oset, unsigned int sigsetsize)
838 sigset_t old_set, new_set;
840 mm_segment_t old_fs = get_fs();
842 if (set && get_sigset(&new_set, set))
846 ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL,
847 oset ? (sigset_t __user *)&old_set : NULL,
851 if (!ret && oset && put_sigset(&old_set, oset))
857 asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
858 unsigned int sigsetsize)
862 mm_segment_t old_fs = get_fs();
865 ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize);
868 if (!ret && put_sigset(&set, uset))
874 asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
878 mm_segment_t old_fs = get_fs();
880 if (copy_from_user (&info, uinfo, 3*sizeof(int)) ||
881 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
884 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
890 sys32_waitid(int which, compat_pid_t pid,
891 compat_siginfo_t __user *uinfo, int options,
892 struct compat_rusage __user *uru)
897 mm_segment_t old_fs = get_fs();
901 ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
902 uru ? (struct rusage __user *) &ru : NULL);
905 if (ret < 0 || info.si_signo == 0)
908 if (uru && (ret = put_compat_rusage(&ru, uru)))
911 BUG_ON(info.si_code & __SI_MASK);
912 info.si_code |= __SI_CHLD;
913 return copy_siginfo_to_user32(uinfo, &info);