Specifications

Red Hat Enterprise Linux to Oracle Solaris Porting Guide
59
TABLE 6-2. ENTRY POINTS AND IMPLEMENTATION DIFFERENCES
RHEL ORACLE SOLARIS 11
The kernel module daemon kmod execs modprobe. The kernel searches the linked list of modctl structures looking for
a match to the module name (
mod_modname
).
modprobe looks through the file
/lib/modules/version/modules.dep to see if other
modules must be loaded before the requested module
may be loaded.
If a match is found, return the address of the existing structure;
otherwise, create a new one. Add a new modctl structure to the
linked list.
insmod is fired to load prerequisite modules. Dependencies are defined in the module code and maintained in
the modctl structure by pointers in mod_requisites (other
modules this module depends on) and mod_dependents
(modules that depend on this one).
The symbol table is retrieved via query_module()
system call.
The _info() function returns information about a loadable
module. Within this function, the call mod_info() has to be made.
insmod
links prerequisite modules
The create_module() syscall is invoked next, passing
the module's name and its final size.
Enter the kernel runtime linker, krtld, to create address space
segments and bindings, and load the object into memory.
Allocate the module structure ().
Allocate space for the module's symbols in the kernel's kobj_map
resource map.
Loop through the segments of the module being loaded, and
allocate and map space for text and data.
Load the kernel object into memory, linking the object's segments
into the appropriate kernel address space segments.
Set the mod_loaded bit in the module's modctl structure, and
increment the mod_loadcnt.
insmod
links the module to the kernel. Create a link to the module's
mod_linkage
structure.
insmod calls the init_module() system call. Execute the module's mod_install function indirectly by looking
up the module _init() routine and calling it.
To delete a module, the delete_module() system call
is made.
_fini() prepares a loadable module for unloading.
Within _fini(), a call to mod_remove() has to be placed. It is
also wise to catch the return values in order to report errors while
unloading the module.