KLD loading, liking

Ed Schouten ed at 80386.nl
Sun Nov 16 02:09:25 PST 2008


* Alexej Sokolov <bsd.quest at googlemail.com> wrote:
> sysinit_set -contain a structure with a pointer to function which will be
> called by loading of KLD

When you place SYSINIT() lines in your code, you can request functions
to be called when the code is loaded. There are also some macro's such
as MTX_SYSINIT(), which is a friendly wrapper around SYSINIT() which
initialises a mutex.

> modmetadata_set - what kind of information is there and which functions of
> linking/loading use it ?

Each loadable kernel module contains a structure that contains the
module name, but also a function pointer to the routine that contains
the module's load/unload function. If this function returns an error,
the kernel module will not be (un)loaded. Take a look at the simple
kernel modules such as snp(4).

> What exact does the macro MODULE_DEPEND ? The man page is to short, and I
> guess it tell no all things that the macro does.

MODULE_DEPEND is used to say: this kernel module also depends on another
module (i.e. the USB printer module depends on the USB code). Tools like
kldload can then automatically load the missing modules.

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20081116/7b11a771/attachment.pgp


More information about the freebsd-hackers mailing list