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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
See: http://marc.theaimsgroup.com/?m=115412412427996

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);
    close(fd);

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux