aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
authorToyo Abe <toyoa@mvista.com>2006-09-29 05:00:28 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:15 -0400
commit1711ef3866b0360e102327389fe4b76c849bbe83 (patch)
treeb74a2cb6167840563d450859a571d6685966b771 /kernel/posix-cpu-timers.c
parent9c4751fd0eab5b8ebbfafb28cbcc8e03b0da5933 (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/posix-cpu-timers.c')
-rw-r--r--kernel/posix-cpu-timers.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index d38d9ec3276c..5667fef89dd1 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1393,8 +1393,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
1393 } 1393 }
1394} 1394}
1395 1395
1396static long posix_cpu_clock_nanosleep_restart(struct restart_block *);
1397
1398int posix_cpu_nsleep(const clockid_t which_clock, int flags, 1396int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1399 struct timespec *rqtp, struct timespec __user *rmtp) 1397 struct timespec *rqtp, struct timespec __user *rmtp)
1400{ 1398{
@@ -1471,7 +1469,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1471 copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) 1469 copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
1472 return -EFAULT; 1470 return -EFAULT;
1473 1471
1474 restart_block->fn = posix_cpu_clock_nanosleep_restart; 1472 restart_block->fn = posix_cpu_nsleep_restart;
1475 /* Caller already set restart_block->arg1 */ 1473 /* Caller already set restart_block->arg1 */
1476 restart_block->arg0 = which_clock; 1474 restart_block->arg0 = which_clock;
1477 restart_block->arg1 = (unsigned long) rmtp; 1475 restart_block->arg1 = (unsigned long) rmtp;
@@ -1484,8 +1482,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1484 return error; 1482 return error;
1485} 1483}
1486 1484
1487static long 1485long posix_cpu_nsleep_restart(struct restart_block *restart_block)
1488posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block)
1489{ 1486{
1490 clockid_t which_clock = restart_block->arg0; 1487 clockid_t which_clock = restart_block->arg0;
1491 struct timespec __user *rmtp; 1488 struct timespec __user *rmtp;
@@ -1524,6 +1521,10 @@ static int process_cpu_nsleep(const clockid_t which_clock, int flags,
1524{ 1521{
1525 return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp); 1522 return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);
1526} 1523}
1524static long process_cpu_nsleep_restart(struct restart_block *restart_block)
1525{
1526 return -EINVAL;
1527}
1527static int thread_cpu_clock_getres(const clockid_t which_clock, 1528static int thread_cpu_clock_getres(const clockid_t which_clock,
1528 struct timespec *tp) 1529 struct timespec *tp)
1529{ 1530{
@@ -1544,6 +1545,10 @@ static int thread_cpu_nsleep(const clockid_t which_clock, int flags,
1544{ 1545{
1545 return -EINVAL; 1546 return -EINVAL;
1546} 1547}
1548static long thread_cpu_nsleep_restart(struct restart_block *restart_block)
1549{
1550 return -EINVAL;
1551}
1547 1552
1548static __init int init_posix_cpu_timers(void) 1553static __init int init_posix_cpu_timers(void)
1549{ 1554{
@@ -1553,6 +1558,7 @@ static __init int init_posix_cpu_timers(void)
1553 .clock_set = do_posix_clock_nosettime, 1558 .clock_set = do_posix_clock_nosettime,
1554 .timer_create = process_cpu_timer_create, 1559 .timer_create = process_cpu_timer_create,
1555 .nsleep = process_cpu_nsleep, 1560 .nsleep = process_cpu_nsleep,
1561 .nsleep_restart = process_cpu_nsleep_restart,
1556 }; 1562 };
1557 struct k_clock thread = { 1563 struct k_clock thread = {
1558 .clock_getres = thread_cpu_clock_getres, 1564 .clock_getres = thread_cpu_clock_getres,
@@ -1560,6 +1566,7 @@ static __init int init_posix_cpu_timers(void)
1560 .clock_set = do_posix_clock_nosettime, 1566 .clock_set = do_posix_clock_nosettime,
1561 .timer_create = thread_cpu_timer_create, 1567 .timer_create = thread_cpu_timer_create,
1562 .nsleep = thread_cpu_nsleep, 1568 .nsleep = thread_cpu_nsleep,
1569 .nsleep_restart = thread_cpu_nsleep_restart,
1563 }; 1570 };
1564 1571
1565 register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process); 1572 register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process);