aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/compat.c')
-rw-r--r--kernel/compat.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index 06cbb0619531..9214dcd087b7 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -890,10 +890,9 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
890{ 890{
891 compat_sigset_t s32; 891 compat_sigset_t s32;
892 sigset_t s; 892 sigset_t s;
893 int sig;
894 struct timespec t; 893 struct timespec t;
895 siginfo_t info; 894 siginfo_t info;
896 long ret, timeout; 895 long ret;
897 896
898 if (sigsetsize != sizeof(sigset_t)) 897 if (sigsetsize != sizeof(sigset_t))
899 return -EINVAL; 898 return -EINVAL;
@@ -901,45 +900,19 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
901 if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t))) 900 if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
902 return -EFAULT; 901 return -EFAULT;
903 sigset_from_compat(&s, &s32); 902 sigset_from_compat(&s, &s32);
904 sigdelsetmask(&s,sigmask(SIGKILL)|sigmask(SIGSTOP));
905 signotset(&s);
906 903
907 timeout = MAX_SCHEDULE_TIMEOUT;
908 if (uts) { 904 if (uts) {
909 if (get_compat_timespec (&t, uts)) 905 if (get_compat_timespec(&t, uts))
910 return -EFAULT; 906 return -EFAULT;
911 if (!timespec_valid(&t))
912 return -EINVAL;
913 timeout = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
914 } 907 }
915 908
916 spin_lock_irq(&current->sighand->siglock); 909 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
917 sig = dequeue_signal(current, &s, &info);
918 if (!sig && timeout) {
919 current->real_blocked = current->blocked;
920 sigandsets(&current->blocked, &current->blocked, &s);
921 recalc_sigpending();
922 spin_unlock_irq(&current->sighand->siglock);
923
924 timeout = schedule_timeout_interruptible(timeout);
925
926 spin_lock_irq(&current->sighand->siglock);
927 sig = dequeue_signal(current, &s, &info);
928 current->blocked = current->real_blocked;
929 siginitset(&current->real_blocked, 0);
930 recalc_sigpending();
931 }
932 spin_unlock_irq(&current->sighand->siglock);
933 910
934 if (sig) { 911 if (ret > 0 && uinfo) {
935 ret = sig; 912 if (copy_siginfo_to_user32(uinfo, &info))
936 if (uinfo) { 913 ret = -EFAULT;
937 if (copy_siginfo_to_user32(uinfo, &info))
938 ret = -EFAULT;
939 }
940 } else {
941 ret = timeout?-EINTR:-EAGAIN;
942 } 914 }
915
943 return ret; 916 return ret;
944 917
945} 918}