views:

65

answers:

1

hi,

Could you please give any basic example of a kernel timer (start_ktimer) implementation in Linux?

/renjith_g

A: 

The best I can tell, Linus never incorporated the ktimer patch into the main line of development. Note that the patch does contain examples of using start_ktimer (see fs/exec.c). If you specifically want to use ktimers, you will need to port the patch circa kernel version 2.6.13 forward to the 2.6.32 kernel.

On the other hand, if all you need is a timer mechanism, the standard kernel timer API may work. For a good discussion of how to use this API as well as examples, see Chapter 7 of the Linux Device Drivers book, specifically, the section titled "The Timer API" (page 198). In this case, the equivalent of start_ktimer() is add_timer().

ctuffli