lkml.org 
[lkml]   [2011]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 12/28] posix-timers: Convert clock_gettime() to clockid_to_kclock()
On Tue, Feb 01, 2011 at 01:51:50PM -0000, Thomas Gleixner wrote:
> --- linux-2.6-tip.orig/kernel/posix-timers.c
> +++ linux-2.6-tip/kernel/posix-timers.c
> @@ -956,18 +955,21 @@ SYSCALL_DEFINE2(clock_settime, const clo
> SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
> struct timespec __user *,tp)
> {
> + struct k_clock *kc = clockid_to_kclock(which_clock);
> struct timespec kernel_tp;
> int error;
>
> - if (invalid_clockid(which_clock))
> + if (!kc)
> return -EINVAL;
> - error = CLOCK_DISPATCH(which_clock, clock_get,
> - (which_clock, &kernel_tp));
> + if (!kc->clock_get)
> + return -EOPNOTSUPP;

An unreadable clock?

I would think that we can require k_clocks to provide the read
function. This could be checked and enforced in register_posix_clock().

> +
> + error = kc->clock_get(which_clock, &kernel_tp);
> +
> if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))
> error = -EFAULT;
>
> return error;
> -
> }

Thanks,
Richard


\
 
 \ /
  Last update: 2011-02-02 10:13    [from the cache]
©2003-2011 Jasper Spaans