#include <libkern/OSKextLib.h>
libkern/OSKextLib.h
@header
Declares functions, basic return values, and other constants
related to kernel extensions (kexts).
macrosub_libkern_kext
#define sub_libkern_kext err_sub(2)
macrolibkern_kext_err
#define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code))
macrokOSKextReturnInternalError
@define kOSKextReturnInternalError
@abstract An internal error in the kext library.
Contrast with <code>@link //apple_ref/c/econst/OSReturnError
OSReturnError@/link</code>.
#define kOSKextReturnInternalError libkern_kext_err(0x1)
macrokOSKextReturnNoMemory
@define kOSKextReturnNoMemory
@abstract Memory allocation failed.
#define kOSKextReturnNoMemory libkern_kext_err(0x2)
macrokOSKextReturnNoResources
@define kOSKextReturnNoResources
@abstract Some resource other than memory (such as available load tags)
is exhausted.
#define kOSKextReturnNoResources libkern_kext_err(0x3)
macrokOSKextReturnNotPrivileged
@define kOSKextReturnNotPrivileged
@abstract The caller lacks privileges to perform the requested operation.
#define kOSKextReturnNotPrivileged libkern_kext_err(0x4)
macrokOSKextReturnInvalidArgument
@define kOSKextReturnInvalidArgument
@abstract Invalid argument.
#define kOSKextReturnInvalidArgument libkern_kext_err(0x5)
macrokOSKextReturnNotFound
@define kOSKextReturnNotFound
@abstract Search item not found.
#define kOSKextReturnNotFound libkern_kext_err(0x6)
macrokOSKextReturnBadData
@define kOSKextReturnBadData
@abstract Malformed data (not used for XML).
#define kOSKextReturnBadData libkern_kext_err(0x7)
macrokOSKextReturnSerialization
@define kOSKextReturnSerialization
@abstract Error converting or (un)serializing URL, string, or XML.
#define kOSKextReturnSerialization libkern_kext_err(0x8)
macrokOSKextReturnUnsupported
@define kOSKextReturnUnsupported
@abstract Operation is no longer or not yet supported.
#define kOSKextReturnUnsupported libkern_kext_err(0x9)
macrokOSKextReturnDisabled
@define kOSKextReturnDisabled
@abstract Operation is currently disabled.
#define kOSKextReturnDisabled libkern_kext_err(0xa)
macrokOSKextReturnNotAKext
@define kOSKextReturnNotAKext
@abstract Bundle is not a kernel extension.
#define kOSKextReturnNotAKext libkern_kext_err(0xb)
macrokOSKextReturnValidation
@define kOSKextReturnValidation
@abstract Validation failures encountered; check diagnostics for details.
#define kOSKextReturnValidation libkern_kext_err(0xc)
macrokOSKextReturnAuthentication
@define kOSKextReturnAuthentication
@abstract Authetication failures encountered; check diagnostics for details.
#define kOSKextReturnAuthentication libkern_kext_err(0xd)
macrokOSKextReturnDependencies
@define kOSKextReturnDependencies
@abstract Dependency resolution failures encountered; check diagnostics for details.
#define kOSKextReturnDependencies libkern_kext_err(0xe)
macrokOSKextReturnArchNotFound
@define kOSKextReturnArchNotFound
@abstract Kext does not contain code for the requested architecture.
#define kOSKextReturnArchNotFound libkern_kext_err(0xf)
macrokOSKextReturnCache
@define kOSKextReturnCache
@abstract An error occurred processing a system kext cache.
#define kOSKextReturnCache libkern_kext_err(0x10)
macrokOSKextReturnDeferred
@define kOSKextReturnDeferred
@abstract Operation has been posted asynchronously to user space (kernel only).
#define kOSKextReturnDeferred libkern_kext_err(0x11)
macrokOSKextReturnBootLevel
@define kOSKextReturnBootLevel
@abstract Kext not loadable or operation not allowed at current boot level.
#define kOSKextReturnBootLevel libkern_kext_err(0x12)
macrokOSKextReturnNotLoadable
@define kOSKextReturnNotLoadable
@abstract Kext cannot be loaded; check diagnostics for details.
#define kOSKextReturnNotLoadable libkern_kext_err(0x13)
macrokOSKextReturnLoadedVersionDiffers
@define kOSKextReturnLoadedVersionDiffers
@abstract A different version (or executable UUID, or executable by checksum)
of the requested kext is already loaded.
#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14)
macrokOSKextReturnDependencyLoadError
@define kOSKextReturnDependencyLoadError
@abstract A load error occurred on a dependency of the kext being loaded.
#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15)
macrokOSKextReturnLinkError
@define kOSKextReturnLinkError
@abstract A link failure occured with this kext or a dependency.
#define kOSKextReturnLinkError libkern_kext_err(0x16)
macrokOSKextReturnStartStopError
@define kOSKextReturnStartStopError
@abstract The kext start or stop routine returned an error.
#define kOSKextReturnStartStopError libkern_kext_err(0x17)
macrokOSKextReturnInUse
@define kOSKextReturnInUse
@abstract The kext is currently in use or has outstanding references,
and cannot be unloaded.
#define kOSKextReturnInUse libkern_kext_err(0x18)
macrokOSKextReturnTimeout
@define kOSKextReturnTimeout
@abstract A kext request has timed out.
#define kOSKextReturnTimeout libkern_kext_err(0x19)
macrokOSKextReturnStopping
@define kOSKextReturnStopping
@abstract The kext is in the process of stopping; requests cannot be made.
#define kOSKextReturnStopping libkern_kext_err(0x1a)
macrokOSKextReturnSystemPolicy
@define kOSKextReturnSystemPolicy
@abstract The kext was prevented from loading due to system policy.
#define kOSKextReturnSystemPolicy libkern_kext_err(0x1b)
macrokOSKextReturnKCLoadFailure
@define kOSKextReturnKCLoadFailure
@abstract Loading of the System KC failed
#define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c)
macrokOSKextReturnKCLoadFailureSystemKC
@define kOSKextReturnKCLoadFailureSystemKC
@abstract Loading of the System KC failed
This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
with: kOSKextReturnKCLoadFailureAuxKC
If both the System and Aux KCs fail to load, then the error code will be:
libkern_kext_err(0x1f)
#define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d)
macrokOSKextReturnKCLoadFailureAuxKC
@define kOSKextReturnKCLoadFailureAuxKC
@abstract Loading of the Aux KC failed
This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
with: kOSKextReturnKCLoadFailureSystemKC
If both the System and Aux KCs fail to load, then the error code will be:
libkern_kext_err(0x1f)
#define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e)
macrokOSBundleCompatibleVersionKey
@define kOSBundleCompatibleVersionKey
@abstract 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"
macrokOSBundleEnableKextLoggingKey
@define kOSBundleEnableKextLoggingKey
@abstract Set to true to have the kernel kext logging spec applied
to the kext.
See <code>@link //apple_ref/c/econst/OSKextLogSpec
OSKextLogSpec@/link</code>.
#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging"
macrokOSBundleIsInterfaceKey
@define kOSBundleIsInterfaceKey
@abstract A boolean value indicating whether the kext executable
contains only symbol references.
#define kOSBundleIsInterfaceKey "OSBundleIsInterface"
macrokOSBundleLibrariesKey
@define kOSBundleLibrariesKey
@abstract A dictionary listing link dependencies for this kext.
Keys are bundle identifiers, values are version strings.
#define kOSBundleLibrariesKey "OSBundleLibraries"
macrokOSBundleRequiredKey
@define kOSBundleRequiredKey
@abstract A string indicating in which kinds of startup this kext
may need to load during early startup (before
<code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>).
@discussion The value is one of:
<ul>
<li>@link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link</li>
<li>@link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link</li>
<li>@link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link</li>
<li>@link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link</li>
<li>@link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link</li>
</ul>
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.
#define kOSBundleRequiredKey "OSBundleRequired"
macrokOSBundleRequireExplicitLoadKey
@define kOSBundleRequireExplicitLoadKey
@abstract A boolean value indicating whether the kext requires an
explicit kextload in order to start/match.
#define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad"
macrokOSBundleAllowUserLoadKey
@define kOSBundleAllowUserLoadKey
@abstract A boolean value indicating whether
<code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>
will honor a non-root process's request to load a kext.
@discussion See <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL
KextManagerLoadKextWithURL@/link</code>
and <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier
KextManagerLoadKextWithIdentifier@/link</code>.
#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad"
macrokOSBundleAllowUserTerminateKey
@define kOSBundleAllowUserTerminateKey
@abstract A boolean value indicating whether the kextunload tool
is allowed to issue IOService terminate to classes defined in this kext.
@discussion A boolean value indicating whether the kextunload tool
is allowed to issue IOService terminate to classes defined in this kext.
#define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate"
macrokOSKernelResourceKey
@define kOSKernelResourceKey
@abstract A boolean value indicating whether the kext represents a built-in
component of the kernel.
#define kOSKernelResourceKey "OSKernelResource"
macrokOSKextVariantOverrideKey
@define kOSKextVariantOverrideKey
@abstract A dictionary with target names as key and a target-specific variant
name as value.
#define kOSKextVariantOverrideKey "OSKextVariantOverride"
macrokIOKitPersonalitiesKey
@define kIOKitPersonalitiesKey
@abstract A dictionary of dictionaries used in matching for I/O Kit drivers.
#define kIOKitPersonalitiesKey "IOKitPersonalities"
macrokIOPersonalityPublisherKey
@define kIOPersonalityPublisherKey
@abstract Used in personalities sent to the I/O Kit,
contains the CFBundleIdentifier of the kext
that the personality originated in.
#define kIOPersonalityPublisherKey "IOPersonalityPublisher"
macrokOSMutableSegmentCopy
@define kOSMutableSegmentCopy
@abstract A boolean value indicating whether the kext requires a copy of
its mutable segments to be kept in memory, and then reset when the kext
unloads. This should be used with caution as it will increase the
amount of memory used by the kext.
#define kOSMutableSegmentCopy "OSMutableSegmentCopy"
macrokOSBundleDebugLevelKey
@define kOSBundleDebugLevelKey
@abstract Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard).
Value is an integer from 1-6, corresponding to the verbose levels
of kext tools on those releases.
On 10.6 Snow Leopard, use <code>@link OSKextEnableKextLogging
OSKextEnableKextLogging@/link</code>.
#define kOSBundleDebugLevelKey "OSBundleDebugLevel"
macrokOSKextKernelIdentifier
@define kOSKextKernelIdentifier
@abstract This is the CFBundleIdentifier user for the kernel itself.
#define kOSKextKernelIdentifier "__kernel__"
macrokOSKextBundlePackageTypeKext
@define kOSKextBundlePackageTypeKext
@abstract The bundle type value for Kernel Extensions.
#define kOSKextBundlePackageTypeKext "KEXT"
macrokOSKextBundlePackageTypeDriverKit
@define kOSKextBundlePackageTypeDriverKit
@abstract The bundle type value for Driver Extensions.
#define kOSKextBundlePackageTypeDriverKit "DEXT"
macrokOSBundleRequiredRoot
@define kOSBundleRequiredRoot
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
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"
macrokOSBundleRequiredLocalRoot
@define kOSBundleRequiredLocalRoot
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
value indicates that the kext may be needed to mount the root filesystem
when starting from a local disk.
#define kOSBundleRequiredLocalRoot "Local-Root"
macrokOSBundleRequiredNetworkRoot
@define kOSBundleRequiredNetworkRoot
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
value indicates that the kext may be needed to mount the root filesystem
when starting over a network connection.
#define kOSBundleRequiredNetworkRoot "Network-Root"
macrokOSBundleRequiredSafeBoot
@define kOSBundleRequiredSafeBoot
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
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"
macrokOSBundleRequiredConsole
@define kOSBundleRequiredConsole
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
value indicates that the kext may be needed for console access
(specifically in a single-user startup when
<code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code>.
does not run)
and should be loaded during early startup.
#define kOSBundleRequiredConsole "Console"
macrokOSBundleRequiredDriverKit
@define kOSBundleRequiredDriverKit
@abstract This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
value indicates that the driver extension's (DriverKit driver's)
personalities must be present in the kernel at early boot (specifically
before <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code> starts)
in order to compete with kexts built into the prelinkedkernel. Note that
kextd is still required to launch the user space driver binary. The IOKit
matching will happen during early boot, and the actual driver launch
will happen after kextd starts.
#define kOSBundleRequiredDriverKit "DriverKit"
typedefOSKextLoadTag
@typedef OSKextLoadTag
@abstract A unique identifier assigned to a loaded instanace of a kext.
@discussion If a kext is unloaded and later reloaded, the new instance
has a different load tag.
A kext can get its own load tag in the <code>kmod_info_t</code>
structure passed into its module start routine, as the
<code>id</code> field (cast to this type).
typedef uint32_t OSKextLoadTag
macrokOSKextInvalidLoadTag
@define kOSKextInvalidLoadTag
@abstract A load tag value that will never be used for a loaded kext;
indicates kext not found.
#define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1))