Re: [PATCH] RTC: Add mmap method to rtc character driver

From: Edgar Toernig
Date: Sat Jul 29 2006 - 19:16:10 EST

Keith Packard wrote:
> A jiffy counter is sufficient for the X server; all I need is some
> indication that time has passed with a resolution of 10 to 20 ms. I
> check this after each X request is processed as that is the scheduling
> granularity. An X request can range in time from .1us to 100 seconds, so
> I really want to just check after each request rather than attempt some
> heuristic.

That's exactly what the mmap interface of /dev/itimer does.

Example code:

volatile unsigned long *counter;
fd=open("/dev/itimer", O_RDWR);
write(fd, "20/1000\n", 8);
counter = mmap(0, sizeof(*counter), PROT_READ, MAP_PRIVATE, fd, 0);

Now, "*counter" is incremented every 20 ms by the kernel.

Ciao, ET.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at