aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-01 08:51:20 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:13 -0500
commit3751f9f29bcbc19bd10e92254a273486f150c245 (patch)
treeb359b47023f268cc741ac7c1ca88892c96d41df9 /kernel/posix-cpu-timers.c
parent59bd5bc24aa69f6c62da1e242c16f09f667def96 (diff)
posix-timers: Cleanup restart_block usage
posix timers still use the legacy arg0-arg3 members of restart_block. Use restart_block.nanosleep instead Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <johnstul@us.ibm.com> Tested-by: Richard Cochran <richard.cochran@omicron.at> LKML-Reference: <20110201134418.232288779@linutronix.de>
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r--kernel/posix-cpu-timers.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 816cd49a5ad9..9e617b00afa9 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1485,7 +1485,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1485 struct timespec *rqtp, struct timespec __user *rmtp) 1485 struct timespec *rqtp, struct timespec __user *rmtp)
1486{ 1486{
1487 struct restart_block *restart_block = 1487 struct restart_block *restart_block =
1488 &current_thread_info()->restart_block; 1488 &current_thread_info()->restart_block;
1489 struct itimerspec it; 1489 struct itimerspec it;
1490 int error; 1490 int error;
1491 1491
@@ -1501,50 +1501,42 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1501 1501
1502 if (error == -ERESTART_RESTARTBLOCK) { 1502 if (error == -ERESTART_RESTARTBLOCK) {
1503 1503
1504 if (flags & TIMER_ABSTIME) 1504 if (flags & TIMER_ABSTIME)
1505 return -ERESTARTNOHAND; 1505 return -ERESTARTNOHAND;
1506 /* 1506 /*
1507 * Report back to the user the time still remaining. 1507 * Report back to the user the time still remaining.
1508 */ 1508 */
1509 if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) 1509 if (rmtp && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
1510 return -EFAULT; 1510 return -EFAULT;
1511 1511
1512 restart_block->fn = posix_cpu_nsleep_restart; 1512 restart_block->fn = posix_cpu_nsleep_restart;
1513 restart_block->arg0 = which_clock; 1513 restart_block->nanosleep.index = which_clock;
1514 restart_block->arg1 = (unsigned long) rmtp; 1514 restart_block->nanosleep.rmtp = rmtp;
1515 restart_block->arg2 = rqtp->tv_sec; 1515 restart_block->nanosleep.expires = timespec_to_ns(rqtp);
1516 restart_block->arg3 = rqtp->tv_nsec;
1517 } 1516 }
1518 return error; 1517 return error;
1519} 1518}
1520 1519
1521long posix_cpu_nsleep_restart(struct restart_block *restart_block) 1520long posix_cpu_nsleep_restart(struct restart_block *restart_block)
1522{ 1521{
1523 clockid_t which_clock = restart_block->arg0; 1522 clockid_t which_clock = restart_block->nanosleep.index;
1524 struct timespec __user *rmtp;
1525 struct timespec t; 1523 struct timespec t;
1526 struct itimerspec it; 1524 struct itimerspec it;
1527 int error; 1525 int error;
1528 1526
1529 rmtp = (struct timespec __user *) restart_block->arg1; 1527 t = ns_to_timespec(restart_block->nanosleep.expires);
1530 t.tv_sec = restart_block->arg2;
1531 t.tv_nsec = restart_block->arg3;
1532 1528
1533 restart_block->fn = do_no_restart_syscall;
1534 error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it); 1529 error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it);
1535 1530
1536 if (error == -ERESTART_RESTARTBLOCK) { 1531 if (error == -ERESTART_RESTARTBLOCK) {
1532 struct timespec __user *rmtp = restart_block->nanosleep.rmtp;
1537 /* 1533 /*
1538 * Report back to the user the time still remaining. 1534 * Report back to the user the time still remaining.
1539 */ 1535 */
1540 if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) 1536 if (rmtp && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
1541 return -EFAULT; 1537 return -EFAULT;
1542 1538
1543 restart_block->fn = posix_cpu_nsleep_restart; 1539 restart_block->nanosleep.expires = timespec_to_ns(&t);
1544 restart_block->arg0 = which_clock;
1545 restart_block->arg1 = (unsigned long) rmtp;
1546 restart_block->arg2 = t.tv_sec;
1547 restart_block->arg3 = t.tv_nsec;
1548 } 1540 }
1549 return error; 1541 return error;
1550 1542