[Gllug] How to check if module is in kernel ?
Richard Jones
rich at annexia.org
Mon Nov 15 21:55:38 UTC 2010
On Mon, Nov 15, 2010 at 10:27:46AM -0500, Jon Masters wrote:
> 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.
Right, but in the thread we're not talking about the list of loaded
modules, but some list of ill-defined "features" which include loaded
modules, compiled-in code, and things that used to be provided by
one module but are now provided by another.
The original poster needs to go ahead and use the API, and provide
suitable messages from the errors returned if it fails.
Rich.
--
Richard Jones
Red Hat
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list