Date: Mon, 12 Sep 2011 10:42:40 +0200 From: Filippo Sironi <filippo.sironi@gmail.com> To: Riccardo Cattaneo <cattaneo.riccardo@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Kernel timers infrastructure Message-ID: <C0EB65E5-323A-4BB9-BCAA-4EF9E071E751@gmail.com> In-Reply-To: <023BD0FF-053C-4DCB-81EA-5D69B2411819@gmail.com> References: <023BD0FF-053C-4DCB-81EA-5D69B2411819@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is what I wrote for FreeBSD 7.2 and it does not work: = --------------------------------------------------------------------------= ------ #include <sys/param.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/systm.h> static struct callout timer_callout; static void timer_function(void *arg) { if (callout_reset(&timer_callout, hz, timer_function, NULL)) uprintf("callout_reset() !=3D 0\n"); uprintf("Hello, World!\n"); } static int timer_event_handler(struct module *mod, int cmd, void *arg) { switch (cmd) { case MOD_LOAD: callout_init(&timer_callout, CALLOUT_MPSAFE); if (callout_reset(&timer_callout, hz, timer_function, = NULL)) uprintf("callout_reset() !=3D 0\n"); break; case MOD_UNLOAD: callout_drain(&timer_callout); break; case MOD_SHUTDOWN: break; default: return EOPNOTSUPP; } return 0; } static struct moduledata timer_moduledata =3D { "timer", timer_event_handler, NULL }; DECLARE_MODULE(timer, timer_moduledata, SI_SUB_DRIVERS, = SI_ORDER_MIDDLE); = --------------------------------------------------------------------------= ------ but I do not know why... I basically run through many different examples I found within the = kernel and they are not different from this module. Does anyone see any clear issue? Filippo On 10/set/2011, at 19:39, Riccardo Cattaneo wrote: > Hi all, > Me in the same situation: university project, freebsd os, required to = call a certain function X times/second (say, uprintf). > Got no luck till now :( > Thanks > Riccardo_______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C0EB65E5-323A-4BB9-BCAA-4EF9E071E751>