[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts

Kernel Extension and Device Driver Management Kernel Services

The kernel provides a relatively complete set of program and device driver management services. These services include general kernel extension loading and binding services and device driver binding services. Also provided are services that allow kernel extensions to be notified of base kernel configuration changes, user-mode exceptions, and system-wide process state changes.

The following information is provided to assist you in in learning more about kernel services:

Kernel Extension Loading and Binding Services

The kmod_load, kmod_entrypt, and kmod_unload services provide kernel extension loading and binding services. The sysconfig subroutine makes these services available to user-mode programs. However, kernel-mode callers executing in a kernel process environment can also use them. These services provide the same kernel object-file load, unload, and query functions provided by the sysconfig subroutine as well as the capability to obtain a module's entry point with the kernel module ID assigned to the module.

The kmod_load, kmod_entrypt, and kmod_unload services can be used to dynamically alter the set of routines loaded into the kernel based on system configuration and application demand. Subsystems and device drivers can use these services to load large, seldom-used routines on demand. Device driver binding services include the devswadd, devswdel, devswqry services, which are used to add or remove a device driver entry from the dynamically managed device switch table. They also query for information concerning a specific entry in the device switch table.

Other Functions for the Kernel Extension and Device Driver Management Services

Some kernel extensions may be sensitive to the settings of base kernel runtime configurable parameters that are found in the var structure defined in the /usr/include/sys/var.h file. These parameters can be set during system boot or runtime by a privileged user performing system configuration commands that use the sysconfig subroutine to alter values in the var structure. Kernel extensions may register or remove a configuration notification routine with the cfgnadd and cfgndel kernel services. This routine is called each time the sysconfig subroutine is used to change base kernel tunable parameters found in the var structure.

In addition, the prochadd and prochdel kernel services allow kernel extensions to be notified when any process in the system has a state transition, such as being created, exiting, being swapped in or swapped out. The uexadd and uexdel kernel services give kernel extensions the capability to intercept user-mode exceptions. These user-mode exception handlers may use this capability to dynamically reassign access to single-use resources or to clean up after some particular user-mode error. The associated uexblock and uexclear services can be used by these handlers to block and resume process execution when handling these exceptions.

The pio_assist and getexcept kernel services are typically used by device drivers to obtain detailed information about exceptions that occur during I/O bus access. The getexcept service can also be used by any exception handler requiring more information about an exception that has occurred. The selreg kernel service is used by file select operations to register unsatisfied asynchronous poll or select event requests with the kernel. The selnotify kernel service replaces the traditional operating system's selwakeup kernel function and is used by device drivers supporting the poll or select subroutines when asynchronous event notification is requested. The iostadd and iostdel services are used by tty and disk device drivers to register device activity reporting structures to be used by the iostat and vmstat commands.

Finally, the getuerror and setuerror services can be used by kernel extensions that provide or use system calls to access the u t _error field for the current process thread's uthread structure . This is typically used by kernel extensions providing system calls to return error codes, and is used by other kernel extensions to check error codes upon return from a system call (since there is no errno global variable in the kernel).

List of Kernel Extension and Device Driver Management Kernel Services

The Kernel Program/Device Driver Management kernel services are:

cfgnadd Registers a notification routine to be called when system-configurable variables are changed.
cfgndel Removes a notification routine for receiving broadcasts of changes to system configurable variables.
devdump Calls a device driver dump-to-device routine.
devstrat Calls a block device driver's strategy routine.
devswadd Adds a device entry to the device switch table.
devswchg Alters a device switch entry point in the device switch table.
devswdel Deletes a device driver entry from the device switch table.
devswqry Checks the status of a device switch entry in the device switch table.
getexcept Allows kernel exception handlers to retrieve additional exception information.
getuerror Allows kernel extensions to retrieve the current value of the u_error field.
iostadd Registers an I/O statistics structure used for updating I/O statistics reported by the iostat subroutine.
iostdel Removes the registration of an I/O statistics structure used for maintaining I/O statistics on a particular device.
kmod_entrypt Returns a function pointer to a kernel module's entry point.
kmod_load Loads an object file into the kernel or queries for an object file already loaded.
kmod_unload Unloads a kernel object file.
pio_assist Provides a standardized programmed I/O exception handling mechanism for all routines performing programmed I/O.
prochadd Adds a systemwide process state-change notification routine.
prochdel Deletes a process state change notification routine.
selreg Registers an asynchronous poll or select request with the kernel.
selnotify Wakes up processes waiting in a poll or select subroutine or the fp_poll kernel service.
setuerror Allows kernel extensions to set the u_error field in the u area.
uexadd Adds a systemwide exception handler for catching user-mode process exceptions.
uexblock Makes a process nonrunnable when called from a user-mode exception handler.
uexclear Makes a process blocked by the uexblock service runnable again.
uexdel Deletes a previously added system-wide user-mode exception handler.

Related Information

The iostat command, vmstat command.


[ Previous | Next | Contents | Home | Search ]