Unloads a loaded kernel object file and any imported kernel object files that were loaded with it.
The SYS_KULOAD sysconfig operation unloads a previously loaded kernel file and any imported kernel object files that were automatically loaded with it. It does this by decrementing the load and use counts of the specified object file and any object file having symbols imported by the specified object file.
The parmp parameter on the sysconfig subroutine should point to a cfg_load structure, as described for the SYS_KLOAD (SYS_KLOAD sysconfig Operation) operation. The kmid field should specify the kernel module ID that was returned when the object file was loaded by the SYS_KLOAD or SYS_SINGLELOAD (SYS_SINGLELOAD sysconfig Operation) operation. The path and libpath fields are not used for this command and can be set to null. The parmlen parameter should be set to the size of the cfg_load structure.
Upon successful completion, the specified object file (and any other object files containing symbols that the specified object file imports) will have their load and use counts decremented. If there are no users of any of the module's exports and its load count is 0, then the object file is immediately unloaded.
However, if there are users of this module (that is, modules bound to this module's exported symbols), the specified module is not unloaded. Instead, it is unloaded on some subsequent unload request, when its use and load counts have gone to 0. The specified module is not in fact unloaded until all current users have been unloaded.
Notes:
- Care must be taken to ensure that a subroutine has freed all of its system resources before being unloaded. For example, a device driver is typically prepared for unloading by using the SYS_CFGDD (SYS_CFGDD sysconfig Operation) operation and specifying termination.
- If the use count is not 0, and you cannot force it to 0, the only way to terminate operation of the kernel extension is to reboot the machine.
Loader Symbol Binding Support explains the symbol binding support provided when loading kernel object files.
If the unload operation is successful or the specified object file load count is successfully decremented, a value of 0 is returned.
On error, the specified file and
any imported files are not unloaded, nor are their load and use counts
decremented. A value of -1 is returned and the errno global
variable is set to one of the following:
The SYS_CFGDD (SYS_CFGDD sysconfig Operation) sysconfig operation, SYS_KLOAD (SYS_KLOAD sysconfig Operation) sysconfig operation, SYS_SINGLELOAD (SYS_SINGLELOAD sysconfig Operation) sysconfig operation.
The sysconfig (sysconfig Subroutine) subroutine.
Device Configuration Subsystem Programming Introduction in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.
Programming in the Kernel Environment Overview in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.
Understanding Kernel Extension Binding in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.