#include #include #include #include #include #include #include #define MODULE_NAME "tf" #ifdef __KERNEL__ int *buf; struct timer_list timer; static void timeoutfun(unsigned long b) { printk("tf: timeoutfun\n"); vfree(buf); } struct timer_list timer; int __init init_tf(void) { printk("init_tf\n"); buf = vmalloc(10*sizeof(int)); init_timer(&timer); /* Initialization of the timer */ timer.function = &timeoutfun; timer.data = 10; timer.expires = jiffies + (10 * HZ); /* 1 sec */ add_timer(&timer); return 0; } void __exit exit_tf(void) { printk("exit_tf\n"); vfree(buf); } module_init(init_tf); module_exit(exit_tf); MODULE_LICENSE("GPL"); #endif