Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
[pandora-kernel.git] / kernel / compat.c
index 38b1d2c..18197ae 100644 (file)
@@ -293,6 +293,8 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf)
        return compat_jiffies_to_clock_t(jiffies);
 }
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+
 /*
  * Assumption: old_sigset_t and compat_old_sigset_t are both
  * types that can be passed to put_user()/get_user().
@@ -312,6 +314,10 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
        return ret;
 }
 
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+
 asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
                compat_old_sigset_t __user *oset)
 {
@@ -333,6 +339,8 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
        return ret;
 }
 
+#endif
+
 asmlinkage long compat_sys_setrlimit(unsigned int resource,
                struct compat_rlimit __user *rlim)
 {
@@ -882,6 +890,7 @@ sigset_from_compat (sigset_t *set, compat_sigset_t *compat)
        case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );
        }
 }
+EXPORT_SYMBOL_GPL(sigset_from_compat);
 
 asmlinkage long
 compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
@@ -890,10 +899,9 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
 {
        compat_sigset_t s32;
        sigset_t s;
-       int sig;
        struct timespec t;
        siginfo_t info;
-       long ret, timeout = 0;
+       long ret;
 
        if (sigsetsize != sizeof(sigset_t))
                return -EINVAL;
@@ -901,51 +909,19 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
        if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
                return -EFAULT;
        sigset_from_compat(&s, &s32);
-       sigdelsetmask(&s,sigmask(SIGKILL)|sigmask(SIGSTOP));
-       signotset(&s);
 
        if (uts) {
-               if (get_compat_timespec (&t, uts))
+               if (get_compat_timespec(&t, uts))
                        return -EFAULT;
-               if (t.tv_nsec >= 1000000000L || t.tv_nsec < 0
-                               || t.tv_sec < 0)
-                       return -EINVAL;
        }
 
-       spin_lock_irq(&current->sighand->siglock);
-       sig = dequeue_signal(current, &s, &info);
-       if (!sig) {
-               timeout = MAX_SCHEDULE_TIMEOUT;
-               if (uts)
-                       timeout = timespec_to_jiffies(&t)
-                               +(t.tv_sec || t.tv_nsec);
-               if (timeout) {
-                       current->real_blocked = current->blocked;
-                       sigandsets(&current->blocked, &current->blocked, &s);
-
-                       recalc_sigpending();
-                       spin_unlock_irq(&current->sighand->siglock);
-
-                       timeout = schedule_timeout_interruptible(timeout);
-
-                       spin_lock_irq(&current->sighand->siglock);
-                       sig = dequeue_signal(current, &s, &info);
-                       current->blocked = current->real_blocked;
-                       siginitset(&current->real_blocked, 0);
-                       recalc_sigpending();
-               }
-       }
-       spin_unlock_irq(&current->sighand->siglock);
+       ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
 
-       if (sig) {
-               ret = sig;
-               if (uinfo) {
-                       if (copy_siginfo_to_user32(uinfo, &info))
-                               ret = -EFAULT;
-               }
-       }else {
-               ret = timeout?-EINTR:-EAGAIN;
+       if (ret > 0 && uinfo) {
+               if (copy_siginfo_to_user32(uinfo, &info))
+                       ret = -EFAULT;
        }
+
        return ret;
 
 }