From torvalds@osdl.org Wed Oct 20 17:16:21 2004 Date: Wed, 20 Oct 2004 16:59:58 -0700 (PDT) From: Linus Torvalds To: Christoph Lameter Cc: Andrew Morton Subject: Re: POSIX timers broken.. On Wed, 20 Oct 2004, Christoph Lameter wrote: > > Ahh. Patch is already in linus tree which makes this easy: I already fixes this in a (imnsho) cleaner manner. But I don't have any test-cases, so could you please check my version? Linus ------ ===== kernel/posix-timers.c 1.38 vs edited ===== Index: linux-2.6.9/kernel/posix-timers.c =================================================================== --- linux-2.6.9.orig/kernel/posix-timers.c 2004-10-20 19:38:03.000000000 -0700 +++ linux-2.6.9/kernel/posix-timers.c 2004-10-20 19:40:22.000000000 -0700 @@ -1326,12 +1326,8 @@ return do_sys_settimeofday(&new_tp, NULL); } -asmlinkage long -sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp) +static int do_clock_gettime(clockid_t which_clock, struct timespec *tp) { - struct timespec rtn_tp; - int error = 0; - /* Process process specific clocks */ if (which_clock < 0) { task_t *t; @@ -1359,9 +1355,17 @@ !posix_clocks[which_clock].res) return -EINVAL; - error = do_posix_gettime(&posix_clocks[which_clock], &rtn_tp); + return do_posix_gettime(&posix_clocks[which_clock], tp); +} + +asmlinkage long +sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp) +{ + struct timespec kernel_tp; + int error; - if (!error && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) + error = do_clock_gettime(which_clock, &kernel_tp); + if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) error = -EFAULT; return error;