[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

SYS_KULOAD sysconfig Operation

Purpose

Unloads a loaded kernel object file and any imported kernel object files that were loaded with it.

Description

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 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 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:
  1. 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 operation and specifying termination.
  2. 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.

Return Values

If the unload operation is successful or the specified object file load count is successfully decremented, a value of 0 is returned.

Error Codes

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:

EACESS The calling process does not have the required privilege.
EINVAL Invalid module ID or the specified module is no longer loaded or already has a load count of 0.
EFAULT The calling process does not have sufficient authority to access the data area described by the parmp and parmlen parameters provided to the subroutine. This error is also returned if an I/O error occurred when accessing data in this area.

Related Information

The SYS_CFGDD sysconfig operation, SYS_KLOAD sysconfig operation, SYS_SINGLELOAD sysconfig operation.

The sysconfig subroutine.

Device Driver Kernel Extension Overview in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.

Device Configuration Subsystem Programming Introduction in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.

Programming in the Kernel Environment Overview in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.

Understanding Kernel Extension Binding in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]