From 76c077418c03117e8e8dca71c5c1a09cae75f18c Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 9 Jan 2006 20:52:36 -0800 Subject: [PATCH] --- yaml --- r: 17595 b: refs/heads/master c: 6ba1b91213e81aa92b5cf7539f7d2a94ff54947c h: refs/heads/master i: 17593: 23aef586e05d4249901ed062024e53e9e86f6bbe 17591: c7ee20671b01b6a0d214a5710f56637fb8eaeea0 v: v3 --- [refs] | 2 +- trunk/kernel/hrtimer.c | 14 +++++++++++ trunk/kernel/timer.c | 56 ------------------------------------------ 3 files changed, 15 insertions(+), 57 deletions(-) diff --git a/[refs] b/[refs] index ae5b662103ae..2d76b17ee896 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 10c94ec16dd187f8d8dfdbb088e98330c05bf03c +refs/heads/master: 6ba1b91213e81aa92b5cf7539f7d2a94ff54947c diff --git a/trunk/kernel/hrtimer.c b/trunk/kernel/hrtimer.c index 64d37a3c5948..11fde0caee56 100644 --- a/trunk/kernel/hrtimer.c +++ b/trunk/kernel/hrtimer.c @@ -707,6 +707,20 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, return -ERESTART_RESTARTBLOCK; } +asmlinkage long +sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) +{ + struct timespec tu; + + if (copy_from_user(&tu, rqtp, sizeof(tu))) + return -EFAULT; + + if (!timespec_valid(&tu)) + return -EINVAL; + + return hrtimer_nanosleep(&tu, rmtp, HRTIMER_REL, CLOCK_MONOTONIC); +} + /* * Functions related to boot-time initialization: */ diff --git a/trunk/kernel/timer.c b/trunk/kernel/timer.c index 80bf2acf6b08..4f1cb0ab5251 100644 --- a/trunk/kernel/timer.c +++ b/trunk/kernel/timer.c @@ -1120,62 +1120,6 @@ asmlinkage long sys_gettid(void) return current->pid; } -static long __sched nanosleep_restart(struct restart_block *restart) -{ - unsigned long expire = restart->arg0, now = jiffies; - struct timespec __user *rmtp = (struct timespec __user *) restart->arg1; - long ret; - - /* Did it expire while we handled signals? */ - if (!time_after(expire, now)) - return 0; - - expire = schedule_timeout_interruptible(expire - now); - - ret = 0; - if (expire) { - struct timespec t; - jiffies_to_timespec(expire, &t); - - ret = -ERESTART_RESTARTBLOCK; - if (rmtp && copy_to_user(rmtp, &t, sizeof(t))) - ret = -EFAULT; - /* The 'restart' block is already filled in */ - } - return ret; -} - -asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) -{ - struct timespec t; - unsigned long expire; - long ret; - - if (copy_from_user(&t, rqtp, sizeof(t))) - return -EFAULT; - - if ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0)) - return -EINVAL; - - expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); - expire = schedule_timeout_interruptible(expire); - - ret = 0; - if (expire) { - struct restart_block *restart; - jiffies_to_timespec(expire, &t); - if (rmtp && copy_to_user(rmtp, &t, sizeof(t))) - return -EFAULT; - - restart = ¤t_thread_info()->restart_block; - restart->fn = nanosleep_restart; - restart->arg0 = jiffies + expire; - restart->arg1 = (unsigned long) rmtp; - ret = -ERESTART_RESTARTBLOCK; - } - return ret; -} - /* * sys_sysinfo - fill in sysinfo struct */