loadext Device Configuration Subroutine

Purpose

Loads or unloads kernel extensions, or queries for kernel extensions in the kernel.

Syntax

#include <sys/types.h>

mid_t loadext ( dd_name,  load,  query)
char *dd_name;
int load, query;

Parameters

Item Description
dd_name Specifies the name of the kernel extension to be loaded, unloaded, or queried.
load Specifies whether the loadext subroutine should load the kernel extension.
query Specifies whether a query of the kernel extension should be performed.

Description

The loadext device configuration subroutine provides the capability to load or unload kernel extensions. It can also be used to obtain the kernel module identifier (kmid) of a previously loaded object file. The kernel extension name passed in the dd_name parameter is either the base name of the object file or contains directory path information. If the kernel extension path name supplied in the dd_name parameter has no leading ./ (dot, slash), ../ double-dot, slash), or / (slash) characters, then the loadext subroutine concatenates the /usr/lib/drivers file and the base name passed in the dd_name parameter to arrive at an absolute path name. Otherwise, the path name provided in the dd_name parameter is used unmodified.

If the load parameter has a value of True, the specified kernel extension and its kmid are loaded. If the specified object file has already been loaded into the kernel, its load count is incremented and a new copy is not loaded.

If the load parameter has a value of False, the action taken depends on the value of the query parameter. If query is False, the loadext routine requests an unload of the specified kernel extension. This causes the kernel to decrement the load count associated with the object file. If the load count and use count of the object file become 0, the kernel unloads the object file. If the query parameter is True, then the loadext subroutine queries the kernel for the kmid of the specified object file. This kmid is then returned to the caller.

If both the load and query parameters have a value of True, the load function is performed.

Attention: Repeated loading and unloading of kernel extensions may cause a memory leak.

Files

Item Description
/usr/lib/libcfg.a Archive of device configuration subroutines.

Return Values

Upon successful completion, the loadext subroutine returns the kmid. If an error occurs or if the queried object file is not loaded, the routine returns a null value.