tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Kernel modules - documentation?



Hi Paul,

On Fri, May 21, 2010 at 10:04 AM, Paul Goyette <paul%whooppee.com@localhost> 
wrote:
> Is there any documentation on the modules interface or API?  There does not
> seem to be anything in the man pages...

I don't know if there is an "official" documentation already, but
there is an article at hubertf's blog
[http://www.feyrer.de/NetBSD/bx/blosxom.cgi/nb_20090922_2256.html].

There is also an exemple.c file in src/sys/modules.

> My specific questions:
>
> What actually triggers an autoload of a module?  (There seem to be very few
> places where module_autoload() is called.)

I can't help here, but I think that is related with dependences control.

> What is the semantic difference between module_autoload() and a "normal"
> module_load()?

I can't help here too, but I think that autoload() just calls load().

> Does the code which calls either of these routines need to be concerned with
> whether the module has been previously loaded?  Is it OK to load a module
> that has already been loaded?

If you try to load an already loaded module, modload will return an error.

> Given that there is a kernel thread that runs around and attempts to unload
> any unreferenced modules that have been loaded "for a while", is it ever
> necessary or desirable to explicitly unload a module?

I think that you cannot unload a module that is a dependency of
another loaded module. And I *think* also that autoload does the work
of load/unload modules ondemand. But, it is just my assumption.

> What happens if a global symbol referenced by a module doesn't exist? Does
> the module get loaded anyway, leaving the reference unresolved?

Not, the modload will return error.

> Thanks in advance!
>
>
> -------------------------------------------------------------------------
> | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
> | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
> | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
> | Kernel Developer |                          | pgoyette at netbsd.org  |
> -------------------------------------------------------------------------
>

Cheers,
--
Lourival Vieira Neto


Home | Main Index | Thread Index | Old Index