Re: [PATCH] CPU time clock support in clock_* syscalls

From: Christoph Lameter
Date: Tue Oct 05 2004 - 16:31:42 EST


On Tue, 5 Oct 2004, Roland McGrath wrote:

> > Is there a standard for that? Or is it an opaque type that you have
> > defined this way?
>
> Of course there is no standard for the bits used in a clockid_t. This is
> an implementation detail in POSIX terms. POSIX defines function interfaces
> to return clockid_t values (clock_getcpuclockid, pthread_getcpuclockid).
> I have chosen the kernel-user ABI for Linux clockid_t's here, but that is
> only of concern to the kernel and glibc.

Maybe its best then to restrict this definition to glibc? Glibc can muck
around with these bits and then call either

clock_gettime(clocktype,&timespec)

or

clock_process_gettimer(pid, type/clocktype,&timespec)

That way the glibc guys have full control and the kernel does not have
to deal with the bit mongering.

> > Posix only defines a process and a thread clock. This is much more.
>
> Like I said the first time, it's three kinds of clocks. One is what we
> will in future use to define POSIX's CPUTIME clocks in our POSIX
> implementation, and the other two are what we already use to define
> ITIMER_REAL/ITIMER_VIRTUAL in our existing POSIX implementation.

How will you provide the necessary hardware interface for the kernel
clocks?

> > I wonder how glibc will realize access to special timer hardware. Will
> > glibc be able load device drivers for timer chips?
>
> glibc has zero interest in doing any of that. It will use the single new
> "best information" kernel interface when that is available, and it's the
> kernel's concern what the best information available from the hardware is.

Ok then we might best follow my above suggestion. Put the timer stuff
into a separate .c file as you have already done. Rename it to something
like process_clocks.c. posix-timers.c will then only be an interface to a
variety of hardware clocks that glibc may use at will.
-
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/