modload(S)
modload --
load a loadable kernel module on demand
Synopsis
#include <sys/mod.h>
int modload(const char *pathname);
Description
modload allows processes
with privilege P_LOADMOD
to demand-load a loadable module into a running system.
pathname gives the pathname of the module to be loaded,
specified either as a module name or as an absolute pathname.
If pathname specifies a module name,
modload searches for the module's object file on disk
in the list of directories set by
modpath(S)
(including the default directory /etc/conf/mod.d).
If pathname specifies an absolute pathname,
only pathname is used to locate the module's object file.
Tasks performed during the load operation include:
-
open the module's object file on disk
-
allocate kernel memory to hold the module
-
read the module's object file into memory
-
load any modules upon which the module depends
that are not already loaded
-
relocate the module's symbols
-
resolve any external references to kernel symbols made by the module
-
execute the module's wrapper routine
to perform any setup the module requires to initialize itself
-
logically link the module to the running kernel
by creating the module's switch table entries
-
set a flag that prevents the module
from being unloaded by the kernel auto-unload mechanism
Return values
On success, modload returns the integer module id of the loaded module.
On failure, modload returns -1 and sets errno to identify the error.
Errors
In the following conditions, modload fails and sets errno to:
EACCES-
Search permission was denied by a pathname component.
ENOENT-
The file pathname does not exist.
EINVAL-
The file pathname is not preconfigured for dynamic loading
or has invalid dependencies on other modules
(such as a circular dependency).
EPERM-
The caller does not possess P_LOADMOD privileges.
ERELOC-
Error occurred processing the module's object file,
or the module references symbols not defined in the running kernel,
or the module references symbols in another loadable module,
but it did not define its dependence on this module in its Master file.
EBADVER-
The version number specified in the module's wrapper routine
does not match the version number for the running kernel.
ENAMETOOLONG-
pathname is more than MAXPATHLEN characters long.
ENOSYS-
Unable to perform the requested operation
because the loadable modules functions are not configured into the system.
References
idbuild(ADM),
idmodload(ADM),
idtune(ADM),
modadmin(ADM),
modpath(S),
modstat(S),
moduload(S)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005