The kernel provides a set of program and device driver management services. These services include kernel extension loading and unloading services and device driver binding services. Services that allow kernel extensions to be notified of base kernel configuration changes, user-mode exceptions, and process state changes are also provided.
The following information is provided to assist you in in learning more about kernel services:
The kmod_load, kmod_unload, and kmod_entrypt services provide kernel extension loading, unloading, and query services. User-mode programs and kernel processes can use the sysconfig subroutine to invoke the kmod_load and kmod_unload services. The kmod_entrypt service returns a pointer to a kernel extension's entry point.
The kmod_load, 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.
The device driver binding services are devswadd, devswdel, devswchg, and devswqry. The devswadd, devswdel, and devswchg services are used to add, remove, or modify device driver entries in the dynamically-managed device switch table. The devswqry service is used to obtain information about a particular device switch table entry.
Some kernel extensions might 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 automatically during system boot or at runtime by a privileged user. Kernel extensions can register or unregister a configuration notification routine with the cfgnadd and cfgndel kernel services. Each time the sysconfig subroutine is used to change base kernel tunable parameters found in the var structure, each registered configuration notification routine is called.
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, or being swapped in or swapped out.
The uexadd and uexdel kernel services give kernel extensions the capability to intercept user-mode exceptions. A user-mode exception handler can 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 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 provides the same functionality as the selwakeup service found on other operating systems.
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.
The getuerror and setuerror services allow kernel extensions to read or set the ut_error field for the current thread. This field can be used to pass an error code from a system call function to an application program, because kernel extensions do not have direct access to the application's errno variable.
The Kernel Program and 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 read the ut_error field for the current thread. |
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 system wide 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 ut_error field for the current thread. |
uexadd | Adds a system wide exception handler for catching user-mode process exceptions. |
uexblock | Makes the currently active kernel thread not runnable when called from a user-mode exception handler. |
uexclear | Makes a kernel thread blocked by the uexblock service runnable again. |
uexdel | Deletes a previously added system-wide user-mode exception handler. |