Invokes a previously loaded kernel object file at its module entry point.
The SYS_CFGKMOD sysconfig operation invokes a previously loaded kernel object file at its module entry point, typically for initialization or termination functions. The SYS_CFGDD (SYS_CFGDD sysconfig Operation) operation performs a similar function for device drivers.
The parmp parameter on the sysconfig subroutine points to a cfg_kmod structure, which is defined in the sys/sysconfig.h file. The kmid field in this structure specifies the kernel module ID of the module to invoke. This value is returned when using the SYS_KLOAD (SYS_KLOAD sysconfig Operation) or SYS_SINGLELOAD (SYS_SINGLELOAD sysconfig Operation) operation to load the object file.
The cmd field in the cfg_kmod structure is a module-dependent parameter specifying the action that the routine at the module's entry point should perform. This is typically used for initialization and termination commands after loading and prior to unloading the object file.
The mdiptr field in the cfg_kmod structure points to a module-dependent structure whose size is specified by the mdilen field. This field is used to provide module-dependent information to the module to be called. If no such information is needed, the mdiptr field can be null.
If the mdiptr field is not null, then the SYS_CFGKMOD operation builds a uio structure describing the address and length of the module-dependent information in the caller's address space. The mdiptr and mdilen fields are used to fill in the fields of this uio structure. The module is then called at its module entry point with the cmd parameter and a pointer to the uio structure. If there is no module-dependent information to be provided, the uiop parameter passed to the module's entry point is set to null.
The module's entry point should be defined as follows:
int module_entry(cmd, uiop) int cmd; struct uio *uiop;
The definition of the module-dependent information and its length is specific to the module being configured. The called module is responsible for using the appropriate routines to copy the module-dependent information from user to kernel space.
If the kernel module to be invoked is successfully called, its return code determines the value that is returned by the SYS_CFGKMOD operation. If the called module's return code is 0, then the value returned by the sysconfig subroutine is 0. Otherwise the value returned is -1 and the errno global variable is set to the called module's return code.
Errors detected by the
SYS_CFGKMOD operation result in the following values for the
errno global variable:
|Invalid module ID.
|The calling process does not have the required privilege.
|The calling process does not have sufficient authority to access the data area described by the parmp and parmlen parameters provided on the system call. This error is also returned if an I/O error occurred when accessing data in this area.
|Contains structure definitions.
The sysconfig (sysconfig Subroutine) subroutine.
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 uio structure.
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