SYS_SINGLELOAD sysconfig Operation

Purpose

Loads a kernel extension module if it is not already loaded.

Description

The SYS_SINGLELOAD sysconfig operation is identical to the SYS_KLOAD (SYS_KLOAD sysconfig Operation) operation, except that the SYS_SINGLELOAD operation loads the object file only if an object file with the same path name has not already been loaded into the corresponding kernel environment.

If an object file with the same path name has already been loaded, the module ID for that object file is returned in the kmid field and its load count incremented. If the object file is not loaded, this operation performs the load request exactly as defined for the SYS_KLOAD operation.

This option is useful in supporting global kernel routines where only one copy of the routine and its data can be present. Typically routines that export symbols to be added to the kernel name space are of this type.

Note: A path name comparison is done to determine if the same object file has already been loaded. However, this function will erroneously load a new copy of the object file into the kernel if the path name to the object file is expressed differently than it was on a previous load request.

Loader Symbol Binding Support explains the symbol binding support provided when loading kernel object files.

Return Values

The SYS_SINGLELOAD operation returns the same set of error codes that the SYS_KLOAD operation returns.