aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2006-01-09 23:52:37 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:38 -0500
commit97735f25d2ba898ec5e13746451525580631c834 (patch)
treea6da1078f04bec45967bd83f340b6f7bde731f5d /kernel/posix-cpu-timers.c
parent6ba1b91213e81aa92b5cf7539f7d2a94ff54947c (diff)
[PATCH] hrtimer: switch clock_nanosleep to hrtimer nanosleep API
Switch clock_nanosleep to use the new nanosleep functions in hrtimer.c Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> 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.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index abf6990c6eb5..520f6c59948d 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1400,7 +1400,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
1400static long posix_cpu_clock_nanosleep_restart(struct restart_block *); 1400static long posix_cpu_clock_nanosleep_restart(struct restart_block *);
1401 1401
1402int posix_cpu_nsleep(const clockid_t which_clock, int flags, 1402int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1403 struct timespec *rqtp) 1403 struct timespec *rqtp, struct timespec __user *rmtp)
1404{ 1404{
1405 struct restart_block *restart_block = 1405 struct restart_block *restart_block =
1406 &current_thread_info()->restart_block; 1406 &current_thread_info()->restart_block;
@@ -1425,7 +1425,6 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1425 error = posix_cpu_timer_create(&timer); 1425 error = posix_cpu_timer_create(&timer);
1426 timer.it_process = current; 1426 timer.it_process = current;
1427 if (!error) { 1427 if (!error) {
1428 struct timespec __user *rmtp;
1429 static struct itimerspec zero_it; 1428 static struct itimerspec zero_it;
1430 struct itimerspec it = { .it_value = *rqtp, 1429 struct itimerspec it = { .it_value = *rqtp,
1431 .it_interval = {} }; 1430 .it_interval = {} };
@@ -1472,7 +1471,6 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1472 /* 1471 /*
1473 * Report back to the user the time still remaining. 1472 * Report back to the user the time still remaining.
1474 */ 1473 */
1475 rmtp = (struct timespec __user *) restart_block->arg1;
1476 if (rmtp != NULL && !(flags & TIMER_ABSTIME) && 1474 if (rmtp != NULL && !(flags & TIMER_ABSTIME) &&
1477 copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) 1475 copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
1478 return -EFAULT; 1476 return -EFAULT;
@@ -1480,6 +1478,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1480 restart_block->fn = posix_cpu_clock_nanosleep_restart; 1478 restart_block->fn = posix_cpu_clock_nanosleep_restart;
1481 /* Caller already set restart_block->arg1 */ 1479 /* Caller already set restart_block->arg1 */
1482 restart_block->arg0 = which_clock; 1480 restart_block->arg0 = which_clock;
1481 restart_block->arg1 = (unsigned long) rmtp;
1483 restart_block->arg2 = rqtp->tv_sec; 1482 restart_block->arg2 = rqtp->tv_sec;
1484 restart_block->arg3 = rqtp->tv_nsec; 1483 restart_block->arg3 = rqtp->tv_nsec;
1485 1484
@@ -1493,10 +1492,15 @@ static long
1493posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block) 1492posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block)
1494{ 1493{
1495 clockid_t which_clock = restart_block->arg0; 1494 clockid_t which_clock = restart_block->arg0;
1496 struct timespec t = { .tv_sec = restart_block->arg2, 1495 struct timespec __user *rmtp;
1497 .tv_nsec = restart_block->arg3 }; 1496 struct timespec t;
1497
1498 rmtp = (struct timespec __user *) restart_block->arg1;
1499 t.tv_sec = restart_block->arg2;
1500 t.tv_nsec = restart_block->arg3;
1501
1498 restart_block->fn = do_no_restart_syscall; 1502 restart_block->fn = do_no_restart_syscall;
1499 return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t); 1503 return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t, rmtp);
1500} 1504}
1501 1505
1502 1506
@@ -1519,9 +1523,10 @@ static int process_cpu_timer_create(struct k_itimer *timer)
1519 return posix_cpu_timer_create(timer); 1523 return posix_cpu_timer_create(timer);
1520} 1524}
1521static int process_cpu_nsleep(const clockid_t which_clock, int flags, 1525static int process_cpu_nsleep(const clockid_t which_clock, int flags,
1522 struct timespec *rqtp) 1526 struct timespec *rqtp,
1527 struct timespec __user *rmtp)
1523{ 1528{
1524 return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp); 1529 return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);
1525} 1530}
1526static int thread_cpu_clock_getres(const clockid_t which_clock, 1531static int thread_cpu_clock_getres(const clockid_t which_clock,
1527 struct timespec *tp) 1532 struct timespec *tp)
@@ -1539,7 +1544,7 @@ static int thread_cpu_timer_create(struct k_itimer *timer)
1539 return posix_cpu_timer_create(timer); 1544 return posix_cpu_timer_create(timer);
1540} 1545}
1541static int thread_cpu_nsleep(const clockid_t which_clock, int flags, 1546static int thread_cpu_nsleep(const clockid_t which_clock, int flags,
1542 struct timespec *rqtp) 1547 struct timespec *rqtp, struct timespec __user *rmtp)
1543{ 1548{
1544 return -EINVAL; 1549 return -EINVAL;
1545} 1550}