moduload(S)
moduload --
unload a loadable kernel module on demand
Synopsis
#include <sys/mod.h>
int moduload(int modid);
Description
moduload allows processes
with privilege P_LOADMOD
to demand-unload a loadable module--or
all loadable modules--from a running system.
If modid specifies a module identifier,
moduload attempts to unload that module.
If modid specifies 0 (zero),
moduload attempts to unload all loadable modules.
Loadable modules are considered unloadable
if all of the following conditions are true:
-
the module is not currently being used
-
the module is not currently being loaded or unloaded
-
no module that depends on the module is currently loaded
-
profiling is disabled
When moduload finds
that it cannot demand-unload a module
for one of the reasons cited above,
it flags the module as a candidate for subsequent unloading
by the kernel's auto-unload mechanism.
Tasks performed during the unload operation include:
-
logically disconnect the module from the running system
by removing the module's switch table entry
-
execute the module's wrapper routine
to perform any cleanup the module requires to remove itself
from the system
-
free kernel memory allocated for the module
Return values
On success, moduload returns 0.
On failure, moduload returns -1 and sets errno to identify the error.
Errors
In the following conditions, moduload fails and sets errno to:
EBUSY-
Outstanding references to this module exist,
or modules that depend on this module are currently loaded,
or profiling is not enabled,
or this module is in the process of being loaded or unloaded.
EINVAL-
modid does not specify a valid loadable module identifier,
or modid is not currently loaded.
EPERM-
The caller does not possess P_LOADMOD privileges.
ENOSYS-
Unable to perform the requested operation
because the loadable modules functions are not configured into the system.
References
modadmin(ADM),
modload(S),
modpath(S),
modstat(S)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005