[Gllug] How to check if module is in kernel ?

Jon Masters jonathan at jonmasters.org
Mon Nov 15 15:27:46 UTC 2010


On Mon, 2010-11-15 at 14:34 +0000, Richard Jones wrote:
> On Mon, Nov 15, 2010 at 12:12:01PM +0000, Dylan wrote:
> > On Monday 15 Nov 2010, Richard Jones wrote:
> > > Looking for some evidence of the module by what devices, proc entries
> > > or sys entries it exports is the right thing to do.  A variation on
> > > this is to open and use the API blindly, and catch the errors when
> > > specific API calls fail because the module is not present.
> > 
> > I'm not a developer at all, but it seems strange that there is no recognised 
> > method for obtaining this information from the kernel - surely it must 
> > maintain a list of loaded and compiled in modules? How does lsmod get the 
> > information?

lsmod gets the data straight out of /proc/modules, which is the
in-kernel list of loaded modules not built into the kernel. It is also
possible to see all loaded modules (recent kernels should include those
without additional sections, such as parameters) in /sys/module.

> I'm pretty sure this list is *not* maintained actually.

The kernel does maintain such a list.

Jon (module-init-tools maintainer).


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list