#include <sys/types.h> #include <sys/errno.h> #include <sys/ldr.h>
int kmod_unload (kmid, flags) mid_t kmid; uint flags;
kmid | Specifies the kernel module ID of the object file to be unloaded. This kernel module ID is returned when using the kmod_load kernel service. | ||
flags | Flags specifying unload options. The following flag is defined:
|
The kmod_unload kernel service unloads a previously loaded kernel extension object file. The object to be unloaded is specified by the kmid parameter. Upon successful completion, the following objects are unloaded or marked unload pending:
Users of these exports or system calls are modules bound to this module's exported symbols. If there are no users of any of the module's kernel exports or system calls, the module is immediately unloaded. If there are users of this module, the module is not unloaded but marked unload pending.
Marking a module unload pending removes the module's exported symbols from the kernel name space. Any system calls exported by this module are also removed. This prohibits new users of these symbols. The module is unloaded only when all current users have been unloaded.
If the unload is successfully completed or marked pending, a value of 0 is returned. When an error occurs, the specified module and any imported modules are not unloaded. A nonzero return value indicates the error.
The kmod_unload kernel service can be called from the process environment only.
0 | Indicates successful completion. |
EINVAL | Indicates that the kmid parameter, which specifies the kernel module, is not valid or does not correspond to a currently loaded module. |
The kmod_unload kernel service is part of Base Operating System (BOS) Runtime.
The kmod_load kernel service.
Kernel Extension and Device Driver Management Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.