tech-kern archive

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

Re: Kernel modules - documentation?



On May,Friday 21 2010, at 3:04 PM, Paul Goyette wrote:

> Is there any documentation on the modules interface or API?  There does not 
> seem to be anything in the man pages...
> 
> My specific questions:
> 
> What actually triggers an autoload of a module?  (There seem to be very few 
> places where module_autoload() is called.)

Device module_autoloading is done in specfs_open.

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

module_autoload happens automatically when you try to open device node which 
doesn't have 
device driver in kernel.

> 
> 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?
> 

I think that this is not possible and these routines return an error when you 
try to do that.

> 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?

It doesn't work this way there is a thread(workqueue) which try to unload 
module in first 300 seconds or mili seconds I can't remember now. But this 
thread or whatever is it doesn't unload modules older that set limit AFAIK.

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

If you have a module which uses foo routine and it is not defined in kernel or 
loaded modules your module will simply not load.


> 
> 
> 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  |
> -------------------------------------------------------------------------

Regards

Adam.



Home | Main Index | Thread Index | Old Index