diff options
author | Anton Blanchard <anton@samba.org> | 2007-10-15 17:06:04 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-18 16:54:18 -0400 |
commit | 04c227140fed77587432667a574b14736a06dd7f (patch) | |
tree | 56cc470fae9f0d78d499c9ab2ab526acb35440e4 /kernel/posix-timers.c | |
parent | d85714d81cc0408daddb68c10f7fd69eafe7c213 (diff) |
hrtimer: Rework hrtimer_nanosleep to make sys_compat_nanosleep easier
Pull the copy_to_user out of hrtimer_nanosleep and into the callers
(common_nsleep, sys_nanosleep) in preparation for converting
compat_sys_nanosleep to use hrtimers.
Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r-- | kernel/posix-timers.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index d71ed09fe1dd..d11f579d189a 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -981,9 +981,20 @@ sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) | |||
981 | static int common_nsleep(const clockid_t which_clock, int flags, | 981 | static int common_nsleep(const clockid_t which_clock, int flags, |
982 | struct timespec *tsave, struct timespec __user *rmtp) | 982 | struct timespec *tsave, struct timespec __user *rmtp) |
983 | { | 983 | { |
984 | return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ? | 984 | struct timespec rmt; |
985 | HRTIMER_MODE_ABS : HRTIMER_MODE_REL, | 985 | int ret; |
986 | which_clock); | 986 | |
987 | ret = hrtimer_nanosleep(tsave, rmtp ? &rmt : NULL, | ||
988 | flags & TIMER_ABSTIME ? | ||
989 | HRTIMER_MODE_ABS : HRTIMER_MODE_REL, | ||
990 | which_clock); | ||
991 | |||
992 | if (ret && rmtp) { | ||
993 | if (copy_to_user(rmtp, &rmt, sizeof(*rmtp))) | ||
994 | return -EFAULT; | ||
995 | } | ||
996 | |||
997 | return ret; | ||
987 | } | 998 | } |
988 | 999 | ||
989 | asmlinkage long | 1000 | asmlinkage long |