[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 2

SYS_CFGKMOD sysconfig Operation

Purpose

Invokes a previously loaded kernel object file at its module entry point.

Description

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 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 or SYS_SINGLELOAD 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.

Return Values

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.

Error Codes

Errors detected by the SYS_CFGKMOD operation result in the following values for the errno global variable:

EINVAL Invalid module ID.
EACESS The calling process does not have the required privilege.
EFAULT 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.

File

sys/sysconfig.h Contains structure definitions.

Related Information

The sysconfig subroutine.

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

The uio structure.

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

Device Driver Kernel Extension Overview in AIX Version 4 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


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]