Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
static struct timer_list my_timer;
void my_timer_callback(struct timer_list *timer)
{
printk("my_timer_callback called (%ld).\n", jiffies);
mod_timer(&my_timer, jiffies + msecs_to_jiffies(10));
}
static int __init my_init(void)
{
printk("Timer module loaded\n");
timer_setup(&my_timer, my_timer_callback, 0);
mod_timer(&my_timer, jiffies + msecs_to_jiffies(10));
return 0;
}
static void __exit my_exit(void)
{
printk("Timer module unloaded\n");
del_timer(&my_timer);
}
module_init(my_init);
module_exit(my_exit);
MODULE_AUTHOR("developer@kk.com");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
Код: Выделить всё
[ 23.891867] my_timer_callback called (-27618).
[ 23.921886] my_timer_callback called (-27615).
[ 23.941895] my_timer_callback called (-27613).
[ 23.961872] my_timer_callback called (-27611).
.config:
CONFIG_HZ=100
Подробнее здесь: https://stackoverflow.com/questions/788 ... s-always-2