Re: [patch 12/28] posix-timers: Convert clock_gettime() toclockid_to_kclock()

From: Thomas Gleixner
Date: Wed Feb 02 2011 - 04:55:25 EST


On Wed, 2 Feb 2011, Richard Cochran wrote:

> 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().

Fair enough. Though, we should do that in a separate step.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/