y2038: globally rename compat_time to old_time32
[linux-2.6-microblaze.git] / kernel / time / posix-timers.c
index f23cc46..3e71921 100644 (file)
@@ -333,8 +333,8 @@ void posixtimer_rearm(struct siginfo *info)
 
 int posix_timer_event(struct k_itimer *timr, int si_private)
 {
-       struct task_struct *task;
-       int shared, ret = -1;
+       enum pid_type type;
+       int ret = -1;
        /*
         * FIXME: if ->sigq is queued we can race with
         * dequeue_signal()->posixtimer_rearm().
@@ -348,13 +348,8 @@ int posix_timer_event(struct k_itimer *timr, int si_private)
         */
        timr->sigq->info.si_sys_private = si_private;
 
-       rcu_read_lock();
-       task = pid_task(timr->it_pid, PIDTYPE_PID);
-       if (task) {
-               shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
-               ret = send_sigqueue(timr->sigq, task, shared);
-       }
-       rcu_read_unlock();
+       type = !(timr->it_sigev_notify & SIGEV_THREAD_ID) ? PIDTYPE_TGID : PIDTYPE_PID;
+       ret = send_sigqueue(timr->sigq, timr->it_pid, type);
        /* If we failed to send the signal the timer stops. */
        return ret > 0;
 }
@@ -433,11 +428,13 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
 
 static struct pid *good_sigevent(sigevent_t * event)
 {
-       struct task_struct *rtn = current->group_leader;
+       struct pid *pid = task_tgid(current);
+       struct task_struct *rtn;
 
        switch (event->sigev_notify) {
        case SIGEV_SIGNAL | SIGEV_THREAD_ID:
-               rtn = find_task_by_vpid(event->sigev_notify_thread_id);
+               pid = find_vpid(event->sigev_notify_thread_id);
+               rtn = pid_task(pid, PIDTYPE_PID);
                if (!rtn || !same_thread_group(rtn, current))
                        return NULL;
                /* FALLTHRU */
@@ -447,7 +444,7 @@ static struct pid *good_sigevent(sigevent_t * event)
                        return NULL;
                /* FALLTHRU */
        case SIGEV_NONE:
-               return task_pid(rtn);
+               return pid;
        default:
                return NULL;
        }
@@ -758,13 +755,13 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
 #ifdef CONFIG_COMPAT_32BIT_TIME
 
 COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
-                      struct compat_itimerspec __user *, setting)
+                      struct old_itimerspec32 __user *, setting)
 {
        struct itimerspec64 cur_setting;
 
        int ret = do_timer_gettime(timer_id, &cur_setting);
        if (!ret) {
-               if (put_compat_itimerspec64(&cur_setting, setting))
+               if (put_old_itimerspec32(&cur_setting, setting))
                        ret = -EFAULT;
        }
        return ret;
@@ -931,8 +928,8 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
 
 #ifdef CONFIG_COMPAT_32BIT_TIME
 COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
-                      struct compat_itimerspec __user *, new,
-                      struct compat_itimerspec __user *, old)
+                      struct old_itimerspec32 __user *, new,
+                      struct old_itimerspec32 __user *, old)
 {
        struct itimerspec64 new_spec, old_spec;
        struct itimerspec64 *rtn = old ? &old_spec : NULL;
@@ -940,12 +937,12 @@ COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
 
        if (!new)
                return -EINVAL;
-       if (get_compat_itimerspec64(&new_spec, new))
+       if (get_old_itimerspec32(&new_spec, new))
                return -EFAULT;
 
        error = do_timer_settime(timer_id, flags, &new_spec, rtn);
        if (!error && old) {
-               if (put_compat_itimerspec64(&old_spec, old))
+               if (put_old_itimerspec32(&old_spec, old))
                        error = -EFAULT;
        }
        return error;
@@ -1118,7 +1115,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
 #ifdef CONFIG_COMPAT_32BIT_TIME
 
 COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
+                      struct old_timespec32 __user *, tp)
 {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 ts;
@@ -1126,14 +1123,14 @@ COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
        if (!kc || !kc->clock_set)
                return -EINVAL;
 
-       if (compat_get_timespec64(&ts, tp))
+       if (get_old_timespec32(&ts, tp))
                return -EFAULT;
 
        return kc->clock_set(which_clock, &ts);
 }
 
 COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
+                      struct old_timespec32 __user *, tp)
 {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 ts;
@@ -1144,7 +1141,7 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
 
        err = kc->clock_get(which_clock, &ts);
 
-       if (!err && compat_put_timespec64(&ts, tp))
+       if (!err && put_old_timespec32(&ts, tp))
                err = -EFAULT;
 
        return err;
@@ -1183,7 +1180,7 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
 #ifdef CONFIG_COMPAT_32BIT_TIME
 
 COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
+                      struct old_timespec32 __user *, tp)
 {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 ts;
@@ -1193,7 +1190,7 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
                return -EINVAL;
 
        err = kc->clock_getres(which_clock, &ts);
-       if (!err && tp && compat_put_timespec64(&ts, tp))
+       if (!err && tp && put_old_timespec32(&ts, tp))
                return -EFAULT;
 
        return err;
@@ -1240,8 +1237,8 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
 #ifdef CONFIG_COMPAT_32BIT_TIME
 
 COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
-                      struct compat_timespec __user *, rqtp,
-                      struct compat_timespec __user *, rmtp)
+                      struct old_timespec32 __user *, rqtp,
+                      struct old_timespec32 __user *, rmtp)
 {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 t;
@@ -1251,7 +1248,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
        if (!kc->nsleep)
                return -EOPNOTSUPP;
 
-       if (compat_get_timespec64(&t, rqtp))
+       if (get_old_timespec32(&t, rqtp))
                return -EFAULT;
 
        if (!timespec64_valid(&t))