OSKextLib.h

Includes:
<sys/cdefs.h>
<stdint.h>
<mach/kmod.h>
<mach/vm_types.h>
<CoreFoundation/CoreFoundation.h>
<System/libkern/OSReturn.h>

Overview

Declares functions, basic return values, and other constants related to kernel extensions (kexts).

For the kernel-space version of this header, see OSKextLib.h (Kernel Framework)



Groups

Kext Property List Values

These constants encompass established values for kernel extension bundle properties.

Group members:

kOSBundleRequiredConsole

This OSBundleRequired value indicates that the kext may be needed for console access (specifically in a single-user startup when kextd(8). does not run) and should be loaded during early startup.

kOSBundleRequiredLocalRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting from a local disk.

kOSBundleRequiredNetworkRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting over a network connection.

kOSBundleRequiredRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem whether starting from a local or a network volume.

kOSBundleRequiredSafeBoot

This OSBundleRequired value indicates that the kext can be loaded during a safe startup. This value does not normally cause the kext to be read by the booter or included in startup kext caches.

kOSKextKernelIdentifier

This is the CFBundleIdentifier user for the kernel itself.

 

OSReturn Values for Kernel Extensions

Many kext-related functions return these values, as well as those defined under OSReturn and other variants of kern_return_t.

Group members:

kOSKextReturnArchNotFound

Kext does not contain code for the requested architecture.

kOSKextReturnAuthentication

Authetication failures encountered; check diagnostics for details.

kOSKextReturnBadData

Malformed data (not used for XML).

kOSKextReturnBootLevel

Kext not loadable or operation not allowed at current boot level.

kOSKextReturnCache

An error occurred processing a system kext cache.

kOSKextReturnDeferred

Operation has been posted asynchronously to user space (kernel only).

kOSKextReturnDependencies

Dependency resolution failures encountered; check diagnostics for details.

kOSKextReturnDependencyLoadError

A load error occurred on a dependency of the kext being loaded.

kOSKextReturnDisabled

Operation is currently disabled.

kOSKextReturnInternalError

An internal error in the kext library. Contrast with OSReturnError.

kOSKextReturnInUse

The kext is currently in use or has outstanding references, and cannot be unloaded.

kOSKextReturnInvalidArgument

Invalid argument.

kOSKextReturnLinkError

A link failure occured with this kext or a dependency.

kOSKextReturnLoadedVersionDiffers

A different version (or executable UUID, or executable by checksum) of the requested kext is already loaded.

kOSKextReturnNoMemory

Memory allocation failed.

kOSKextReturnNoResources

Some resource other than memory (such as available load tags) is exhausted.

kOSKextReturnNotAKext

Bundle is not a kernel extension.

kOSKextReturnNotFound

Search item not found.

kOSKextReturnNotLoadable

Kext cannot be loaded; check diagnostics for details.

kOSKextReturnNotPrivileged

The caller lacks privileges to perform the requested operation.

kOSKextReturnSerialization

Error converting or (un)serializing URL, string, or XML.

kOSKextReturnStartStopError

The kext start or stop routine returned an error.

kOSKextReturnStopping

The kext is in the process of stopping; requests cannot be made.

kOSKextReturnTimeout

A kext request has timed out.

kOSKextReturnUnsupported

Operation is no longer or not yet supported.

kOSKextReturnValidation

Validation failures encountered; check diagnostics for details.

 

Kext Information

Types, constants, and macros providing a kext with information about itself.

 

Kext Property List Keys

These constants cover CFBundle properties defined for kernel extensions. Because they are used in the kernel, if you want to use one with CFBundle APIs you'll need to wrap it in a CFSTR() macro.

Group members:

kIOKitPersonalitiesKey

A dictionary of dictionaries used in matching for I/O Kit drivers.

kOSBundleAllowUserLoadKey

A boolean value indicating whether kextcache(8) will honor a non-root process's request to load a kext.

kOSBundleCompatibleVersionKey

A string giving the backwards-compatible version of a library kext in extended Mac OS 'vers' format (####.##.##s{1-255} where 's' is a build stage 'd', 'a', 'b', 'f' or 'fc').

kOSBundleEnableKextLoggingKey

Set to true to have the kernel kext logging spec applied to the kext. See OSKextLogSpec.

kOSBundleIsInterfaceKey

A boolean value indicating whether the kext executable contains only symbol references.

kOSBundleLibrariesKey

A dictionary listing link dependencies for this kext. Keys are bundle identifiers, values are version strings.

kOSBundleRequiredKey

A string indicating in which kinds of startup this kext may need to load during early startup (before kextcache(8)).

kOSBundleSharedExecutableIdentifierKey

Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard). Value is the bundle identifier of the pseudokext that contains an executable shared by this kext.

kOSKernelResourceKey

A boolean value indicating whether the kext represents a built-in component of the kernel.


Macro Definitions

kIOKitPersonalitiesKey

A dictionary of dictionaries used in matching for I/O Kit drivers.

kOSBundleAllowUserLoadKey

A boolean value indicating whether kextcache(8) will honor a non-root process's request to load a kext.

kOSBundleCompatibleVersionKey

A string giving the backwards-compatible version of a library kext in extended Mac OS 'vers' format (####.##.##s{1-255} where 's' is a build stage 'd', 'a', 'b', 'f' or 'fc').

kOSBundleEnableKextLoggingKey

Set to true to have the kernel kext logging spec applied to the kext. See OSKextLogSpec.

kOSBundleIsInterfaceKey

A boolean value indicating whether the kext executable contains only symbol references.

kOSBundleLibrariesKey

A dictionary listing link dependencies for this kext. Keys are bundle identifiers, values are version strings.

kOSBundleRequiredConsole

This OSBundleRequired value indicates that the kext may be needed for console access (specifically in a single-user startup when kextd(8). does not run) and should be loaded during early startup.

kOSBundleRequiredKey

A string indicating in which kinds of startup this kext may need to load during early startup (before kextcache(8)).

kOSBundleRequiredLocalRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting from a local disk.

kOSBundleRequiredNetworkRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting over a network connection.

kOSBundleRequiredRoot

This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem whether starting from a local or a network volume.

kOSBundleRequiredSafeBoot

This OSBundleRequired value indicates that the kext can be loaded during a safe startup. This value does not normally cause the kext to be read by the booter or included in startup kext caches.

kOSBundleSharedExecutableIdentifierKey

Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard). Value is the bundle identifier of the pseudokext that contains an executable shared by this kext.

kOSKernelResourceKey

A boolean value indicating whether the kext represents a built-in component of the kernel.

kOSKextKernelIdentifier

This is the CFBundleIdentifier user for the kernel itself.

kOSKextReturnArchNotFound

Kext does not contain code for the requested architecture.

kOSKextReturnAuthentication

Authetication failures encountered; check diagnostics for details.

kOSKextReturnBadData

Malformed data (not used for XML).

kOSKextReturnBootLevel

Kext not loadable or operation not allowed at current boot level.

kOSKextReturnCache

An error occurred processing a system kext cache.

kOSKextReturnDeferred

Operation has been posted asynchronously to user space (kernel only).

kOSKextReturnDependencies

Dependency resolution failures encountered; check diagnostics for details.

kOSKextReturnDependencyLoadError

A load error occurred on a dependency of the kext being loaded.

kOSKextReturnDisabled

Operation is currently disabled.

kOSKextReturnInternalError

An internal error in the kext library. Contrast with OSReturnError.

kOSKextReturnInUse

The kext is currently in use or has outstanding references, and cannot be unloaded.

kOSKextReturnInvalidArgument

Invalid argument.

kOSKextReturnLinkError

A link failure occured with this kext or a dependency.

kOSKextReturnLoadedVersionDiffers

A different version (or executable UUID, or executable by checksum) of the requested kext is already loaded.

kOSKextReturnNoMemory

Memory allocation failed.

kOSKextReturnNoResources

Some resource other than memory (such as available load tags) is exhausted.

kOSKextReturnNotAKext

Bundle is not a kernel extension.

kOSKextReturnNotFound

Search item not found.

kOSKextReturnNotLoadable

Kext cannot be loaded; check diagnostics for details.

kOSKextReturnNotPrivileged

The caller lacks privileges to perform the requested operation.

kOSKextReturnSerialization

Error converting or (un)serializing URL, string, or XML.

kOSKextReturnStartStopError

The kext start or stop routine returned an error.

kOSKextReturnStopping

The kext is in the process of stopping; requests cannot be made.

kOSKextReturnTimeout

A kext request has timed out.

kOSKextReturnUnsupported

Operation is no longer or not yet supported.

kOSKextReturnValidation

Validation failures encountered; check diagnostics for details.


kIOKitPersonalitiesKey


A dictionary of dictionaries used in matching for I/O Kit drivers.

#define kIOKitPersonalitiesKey "IOKitPersonalities" 


kOSBundleAllowUserLoadKey


A boolean value indicating whether kextcache(8) will honor a non-root process's request to load a kext.

#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad" 
Discussion

See KextManagerLoadKextWithURL and KextManagerLoadKextWithIdentifier.


kOSBundleCompatibleVersionKey


A string giving the backwards-compatible version of a library kext in extended Mac OS 'vers' format (####.##.##s{1-255} where 's' is a build stage 'd', 'a', 'b', 'f' or 'fc').

#define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion" 


kOSBundleEnableKextLoggingKey


Set to true to have the kernel kext logging spec applied to the kext. See OSKextLogSpec.

#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging" 


kOSBundleIsInterfaceKey


A boolean value indicating whether the kext executable contains only symbol references.

#define kOSBundleIsInterfaceKey "OSBundleIsInterface" 


kOSBundleLibrariesKey


A dictionary listing link dependencies for this kext. Keys are bundle identifiers, values are version strings.

#define kOSBundleLibrariesKey "OSBundleLibraries" 


kOSBundleRequiredConsole


This OSBundleRequired value indicates that the kext may be needed for console access (specifically in a single-user startup when kextd(8). does not run) and should be loaded during early startup.

#define kOSBundleRequiredConsole "Console" 


kOSBundleRequiredKey


A string indicating in which kinds of startup this kext may need to load during early startup (before kextcache(8)).

#define kOSBundleRequiredKey "OSBundleRequired" 
Discussion

The value is one of:

Use this property judiciously. Every kext that declares a value other than "OSBundleRequiredSafeBoot" increases startup time, as the booter must read it into memory, or startup kext caches must include it.


kOSBundleRequiredLocalRoot


This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting from a local disk.

#define kOSBundleRequiredLocalRoot "Local-Root" 


kOSBundleRequiredNetworkRoot


This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem when starting over a network connection.

#define kOSBundleRequiredNetworkRoot "Network-Root" 


kOSBundleRequiredRoot


This OSBundleRequired value indicates that the kext may be needed to mount the root filesystem whether starting from a local or a network volume.

#define kOSBundleRequiredRoot "Root" 


kOSBundleRequiredSafeBoot


This OSBundleRequired value indicates that the kext can be loaded during a safe startup. This value does not normally cause the kext to be read by the booter or included in startup kext caches.

#define kOSBundleRequiredSafeBoot "Safe Boot" 


kOSBundleSharedExecutableIdentifierKey


Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard). Value is the bundle identifier of the pseudokext that contains an executable shared by this kext.

#define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier" 


kOSKernelResourceKey


A boolean value indicating whether the kext represents a built-in component of the kernel.

#define kOSKernelResourceKey "OSKernelResource" 


kOSKextKernelIdentifier


This is the CFBundleIdentifier user for the kernel itself.

#define kOSKextKernelIdentifier "__kernel__" 


kOSKextReturnArchNotFound


Kext does not contain code for the requested architecture.

#define kOSKextReturnArchNotFound libkern_kext_err(0xf) 


kOSKextReturnAuthentication


Authetication failures encountered; check diagnostics for details.

#define kOSKextReturnAuthentication libkern_kext_err(0xd) 


kOSKextReturnBadData


Malformed data (not used for XML).

#define kOSKextReturnBadData libkern_kext_err(0x7) 


kOSKextReturnBootLevel


Kext not loadable or operation not allowed at current boot level.

#define kOSKextReturnBootLevel libkern_kext_err(0x12) 


kOSKextReturnCache


An error occurred processing a system kext cache.

#define kOSKextReturnCache libkern_kext_err(0x10) 


kOSKextReturnDeferred


Operation has been posted asynchronously to user space (kernel only).

#define kOSKextReturnDeferred libkern_kext_err(0x11) 


kOSKextReturnDependencies


Dependency resolution failures encountered; check diagnostics for details.

#define kOSKextReturnDependencies libkern_kext_err(0xe) 


kOSKextReturnDependencyLoadError


A load error occurred on a dependency of the kext being loaded.

#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15) 


kOSKextReturnDisabled


Operation is currently disabled.

#define kOSKextReturnDisabled libkern_kext_err(0xa) 


kOSKextReturnInternalError


An internal error in the kext library. Contrast with OSReturnError.

#define kOSKextReturnInternalError libkern_kext_err(0x1) 


kOSKextReturnInUse


The kext is currently in use or has outstanding references, and cannot be unloaded.

#define kOSKextReturnInUse libkern_kext_err(0x18) 


kOSKextReturnInvalidArgument


Invalid argument.

#define kOSKextReturnInvalidArgument libkern_kext_err(0x5) 


kOSKextReturnLinkError


A link failure occured with this kext or a dependency.

#define kOSKextReturnLinkError libkern_kext_err(0x16) 


kOSKextReturnLoadedVersionDiffers


A different version (or executable UUID, or executable by checksum) of the requested kext is already loaded.

#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14) 


kOSKextReturnNoMemory


Memory allocation failed.

#define kOSKextReturnNoMemory libkern_kext_err(0x2) 


kOSKextReturnNoResources


Some resource other than memory (such as available load tags) is exhausted.

#define kOSKextReturnNoResources libkern_kext_err(0x3) 


kOSKextReturnNotAKext


Bundle is not a kernel extension.

#define kOSKextReturnNotAKext libkern_kext_err(0xb) 


kOSKextReturnNotFound


Search item not found.

#define kOSKextReturnNotFound libkern_kext_err(0x6) 


kOSKextReturnNotLoadable


Kext cannot be loaded; check diagnostics for details.

#define kOSKextReturnNotLoadable libkern_kext_err(0x13) 


kOSKextReturnNotPrivileged


The caller lacks privileges to perform the requested operation.

#define kOSKextReturnNotPrivileged libkern_kext_err(0x4) 


kOSKextReturnSerialization


Error converting or (un)serializing URL, string, or XML.

#define kOSKextReturnSerialization libkern_kext_err(0x8) 


kOSKextReturnStartStopError


The kext start or stop routine returned an error.

#define kOSKextReturnStartStopError libkern_kext_err(0x17) 


kOSKextReturnStopping


The kext is in the process of stopping; requests cannot be made.

#define kOSKextReturnStopping libkern_kext_err(0x1a) 


kOSKextReturnTimeout


A kext request has timed out.

#define kOSKextReturnTimeout libkern_kext_err(0x19) 


kOSKextReturnUnsupported


Operation is no longer or not yet supported.

#define kOSKextReturnUnsupported libkern_kext_err(0x9) 


kOSKextReturnValidation


Validation failures encountered; check diagnostics for details.

#define kOSKextReturnValidation libkern_kext_err(0xc) 

 

 

Last Updated: 2009-10-15