diff options
author | Toyo Abe <toyoa@mvista.com> | 2006-09-29 05:00:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:15 -0400 |
commit | 1711ef3866b0360e102327389fe4b76c849bbe83 (patch) | |
tree | b74a2cb6167840563d450859a571d6685966b771 /kernel/hrtimer.c | |
parent | 9c4751fd0eab5b8ebbfafb28cbcc8e03b0da5933 (diff) |
[PATCH] posix-timers: Fix clock_nanosleep() doesn't return the remaining time in compatibility mode
The clock_nanosleep() function does not return the time remaining when the
sleep is interrupted by a signal.
This patch creates a new call out, compat_clock_nanosleep_restart(), which
handles returning the remaining time after a sleep is interrupted. This
patch revives clock_nanosleep_restart(). It is now accessed via the new
call out. The compat_clock_nanosleep_restart() is used for compatibility
access.
Since this is implemented in compatibility mode the normal path is
virtually unaffected - no real performance impact.
Signed-off-by: Toyo Abe <toyoa@mvista.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 21c38a7e666b..d0ba190dfeb6 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -693,7 +693,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod | |||
693 | return t->task == NULL; | 693 | return t->task == NULL; |
694 | } | 694 | } |
695 | 695 | ||
696 | static long __sched nanosleep_restart(struct restart_block *restart) | 696 | long __sched hrtimer_nanosleep_restart(struct restart_block *restart) |
697 | { | 697 | { |
698 | struct hrtimer_sleeper t; | 698 | struct hrtimer_sleeper t; |
699 | struct timespec __user *rmtp; | 699 | struct timespec __user *rmtp; |
@@ -702,13 +702,13 @@ static long __sched nanosleep_restart(struct restart_block *restart) | |||
702 | 702 | ||
703 | restart->fn = do_no_restart_syscall; | 703 | restart->fn = do_no_restart_syscall; |
704 | 704 | ||
705 | hrtimer_init(&t.timer, restart->arg3, HRTIMER_ABS); | 705 | hrtimer_init(&t.timer, restart->arg0, HRTIMER_ABS); |
706 | t.timer.expires.tv64 = ((u64)restart->arg1 << 32) | (u64) restart->arg0; | 706 | t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2; |
707 | 707 | ||
708 | if (do_nanosleep(&t, HRTIMER_ABS)) | 708 | if (do_nanosleep(&t, HRTIMER_ABS)) |
709 | return 0; | 709 | return 0; |
710 | 710 | ||
711 | rmtp = (struct timespec __user *) restart->arg2; | 711 | rmtp = (struct timespec __user *) restart->arg1; |
712 | if (rmtp) { | 712 | if (rmtp) { |
713 | time = ktime_sub(t.timer.expires, t.timer.base->get_time()); | 713 | time = ktime_sub(t.timer.expires, t.timer.base->get_time()); |
714 | if (time.tv64 <= 0) | 714 | if (time.tv64 <= 0) |
@@ -718,7 +718,7 @@ static long __sched nanosleep_restart(struct restart_block *restart) | |||
718 | return -EFAULT; | 718 | return -EFAULT; |
719 | } | 719 | } |
720 | 720 | ||
721 | restart->fn = nanosleep_restart; | 721 | restart->fn = hrtimer_nanosleep_restart; |
722 | 722 | ||
723 | /* The other values in restart are already filled in */ | 723 | /* The other values in restart are already filled in */ |
724 | return -ERESTART_RESTARTBLOCK; | 724 | return -ERESTART_RESTARTBLOCK; |
@@ -751,11 +751,11 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | |||
751 | } | 751 | } |
752 | 752 | ||
753 | restart = ¤t_thread_info()->restart_block; | 753 | restart = ¤t_thread_info()->restart_block; |
754 | restart->fn = nanosleep_restart; | 754 | restart->fn = hrtimer_nanosleep_restart; |
755 | restart->arg0 = t.timer.expires.tv64 & 0xFFFFFFFF; | 755 | restart->arg0 = (unsigned long) t.timer.base->index; |
756 | restart->arg1 = t.timer.expires.tv64 >> 32; | 756 | restart->arg1 = (unsigned long) rmtp; |
757 | restart->arg2 = (unsigned long) rmtp; | 757 | restart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF; |
758 | restart->arg3 = (unsigned long) t.timer.base->index; | 758 | restart->arg3 = t.timer.expires.tv64 >> 32; |
759 | 759 | ||
760 | return -ERESTART_RESTARTBLOCK; | 760 | return -ERESTART_RESTARTBLOCK; |
761 | } | 761 | } |