Dmitry Krivenok <krivenok.dmi...@gmail.com> writes:
> /* The function called at load/unload. */
> static int event_handler(struct module *module, int event, void *arg)
> {
>   int e = 0; /* Error, 0 for normal return status */
>   switch (event)
>     {
>       case MOD_LOAD:
>         uprintf("Hello FreeBSD kernel!\n");

I'm not sure it's such a good idea to use uprintf() here.  The event
handler can be called in non-process context.

>         int i = 0;
>         for(i = 0; i < 1000; i++)
>           {
>             uprintf("%3d ", i);
>             if(! (i % 10) ) uprintf("\n");
>           }

(i % 10) is not a predicate.  The test should be if (i % 10 == 0).

If you want to work on FreeBSD, I recommend you get used to the
FreeBSD coding style; see 'man 9 style'.

> As you can see the loop was terminated after i==466.  I tried to
> load/unload the module many times but the last printed number was
> always 466.

You filled up a buffer somewhere...

DES
-- 
Dag-Erling Smørgrav - d...@des.no
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to