daca vrei da bagi un text la 1 secunda ;)
/* bof */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/malloc.h>
static struct timer_list my_timer;
void cleanup_module(void);
static void my_timer_timeout(unsigned long data)
{
static int i;
init_timer(&my_timer);
my_timer.expires = jiffies + HZ;
my_timer.function = my_timer_timeout;
add_timer(&my_timer);
printk(KERN_INFO "i este %d\n", i++);
}
int init_module(void)
{
printk(KERN_INFO "Hatz\n");
init_timer(&my_timer);
my_timer.expires = jiffies + HZ;
my_timer.function = my_timer_timeout;
add_timer(&my_timer);
return 0;
}
void cleanup_module(void)
{
del_timer(&my_timer);
}
/* eof */
--------------
gcc -D__KERNEL__ -DMODULE bla bla bla
PS: sa fii cuminte
On Fri, 23 Nov 2001, Andrei Bozeanu wrote:
>
> incerc sa afishez un text la intervale regulate de timp.. ;)
>
> static int trigger(void *data)
> {
>
> printk("<1> test\n");
> while (1) {
> current->state = TASK_INTERRUPTIBLE;
> schedule_timeout(HZ);
> current->state = TASK_RUNNING;
> }
> }
>
> void init_module(void)
> {
> kernel_thread(trigger,NULL,CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
> return;
> }
>
> void cleanup_module(void)
> {}
>
-----
Ionut Spirlea,
http://sgi.rdscv.ro/~ionuts/
---
Send e-mail to '[EMAIL PROTECTED]' with 'unsubscribe rlug' to
unsubscribe from this list.