| 1 | /* |
| 2 | * Copyright (c) 2000 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
| 5 | * |
| 6 | * This file contains Original Code and/or Modifications of Original Code |
| 7 | * as defined in and that are subject to the Apple Public Source License |
| 8 | * Version 2.0 (the 'License'). You may not use this file except in |
| 9 | * compliance with the License. The rights granted to you under the License |
| 10 | * may not be used to create, or enable the creation or redistribution of, |
| 11 | * unlawful or unlicensed copies of an Apple operating system, or to |
| 12 | * circumvent, violate, or enable the circumvention or violation of, any |
| 13 | * terms of an Apple operating system software license agreement. |
| 14 | * |
| 15 | * Please obtain a copy of the License at |
| 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
| 17 | * |
| 18 | * The Original Code and all software distributed under the License are |
| 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 23 | * Please see the License for the specific language governing rights and |
| 24 | * limitations under the License. |
| 25 | * |
| 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
| 27 | */ |
| 28 | /* |
| 29 | * Copyright (c) 1998 Apple Inc. All rights reserved. |
| 30 | * |
| 31 | * HISTORY |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | /* |
| 36 | * Core OSReturn values. |
| 37 | */ |
| 38 | |
| 39 | #ifndef __LIBKERN_OSRETURN_H |
| 40 | #define __LIBKERN_OSRETURN_H |
| 41 | |
| 42 | #include <sys/cdefs.h> |
| 43 | |
| 44 | #include <mach/error.h> |
| 45 | |
| 46 | __BEGIN_DECLS |
| 47 | |
| 48 | |
| 49 | /*! |
| 50 | * @header |
| 51 | * |
| 52 | * Declares functions, basic return values, and other constants |
| 53 | * related to kernel extensions (kexts). |
| 54 | */ |
| 55 | |
| 56 | #if PRAGMA_MARK |
| 57 | #pragma mark Core OSReturn Values for Libkern |
| 58 | #endif |
| 59 | /********************************************************************* |
| 60 | * Core OSReturn Values for Libkern |
| 61 | *********************************************************************/ |
| 62 | /*! |
| 63 | * @group Core OSReturn Values for Libkern |
| 64 | * Some kext and I/O Kit functions can return these values, |
| 65 | * as well as other values of |
| 66 | * <code>kern_return_t</code>. |
| 67 | * |
| 68 | * Many of these return values represent internal errors |
| 69 | * in the Libkern C++ run-time typing information system |
| 70 | * based on @link //apple_ref/doc/class/OSMetaClass OSMetaClass@/link; |
| 71 | * you are unlikely to ever see them. |
| 72 | * |
| 73 | */ |
| 74 | |
| 75 | |
| 76 | /*! |
| 77 | * @typedef OSReturn |
| 78 | * @abstract The return type for many Libkern functions. |
| 79 | */ |
| 80 | typedef kern_return_t OSReturn; |
| 81 | |
| 82 | #ifndef sys_libkern |
| 83 | #define sys_libkern err_system(0x37) |
| 84 | #endif /* sys_libkern */ |
| 85 | |
| 86 | #define sub_libkern_common err_sub(0) |
| 87 | #define sub_libkern_metaclass err_sub(1) |
| 88 | #define sub_libkern_reserved err_sub(-1) |
| 89 | |
| 90 | #define libkern_common_err(return ) (sys_libkern|sub_libkern_common|(return)) |
| 91 | #define libkern_metaclass_err(return ) (sys_libkern|sub_libkern_metaclass|(return)) |
| 92 | |
| 93 | /* See OSKextLib.h for these |
| 94 | * #define sub_libkern_kext err_sub(2) |
| 95 | * #define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code)) |
| 96 | */ |
| 97 | |
| 98 | /*! |
| 99 | * @define kOSReturnSuccess |
| 100 | * @abstract Operation successful. |
| 101 | * Equal to <code>@link //apple_ref/c/econst/KERN_SUCCESS |
| 102 | * KERN_SUCCESS@/link</code>. |
| 103 | */ |
| 104 | #define kOSReturnSuccess KERN_SUCCESS |
| 105 | |
| 106 | /*! |
| 107 | * @define kOSReturnError |
| 108 | * @abstract Unspecified Libkern error. |
| 109 | * <b>Not equal</b> to |
| 110 | * <code>@link //apple_ref/c/econst/KERN_FAILURE |
| 111 | * KERN_FAILURE@/link</code>. |
| 112 | */ |
| 113 | #define kOSReturnError libkern_common_err(1) |
| 114 | |
| 115 | /*! |
| 116 | * @define kOSMetaClassInternal |
| 117 | * @abstract Internal OSMetaClass run-time error. |
| 118 | */ |
| 119 | #define kOSMetaClassInternal libkern_metaclass_err(1) |
| 120 | |
| 121 | /*! |
| 122 | * @define kOSMetaClassHasInstances |
| 123 | * @abstract A kext cannot be unloaded because there are instances |
| 124 | * derived from Libkern C++ classes that it defines. |
| 125 | */ |
| 126 | #define kOSMetaClassHasInstances libkern_metaclass_err(2) |
| 127 | |
| 128 | /*! |
| 129 | * @define kOSMetaClassNoInit |
| 130 | * @abstract Internal error: The Libkern C++ class registration system |
| 131 | * was not properly initialized during kext loading. |
| 132 | */ |
| 133 | #define kOSMetaClassNoInit libkern_metaclass_err(3) |
| 134 | // OSMetaClass::preModLoad wasn't called, runtime internal error |
| 135 | |
| 136 | /*! |
| 137 | * @define kOSMetaClassNoTempData |
| 138 | * @abstract Internal error: An allocation failure occurred |
| 139 | * registering Libkern C++ classes during kext loading. |
| 140 | */ |
| 141 | #define kOSMetaClassNoTempData libkern_metaclass_err(4) |
| 142 | // Allocation failure internal data |
| 143 | |
| 144 | /*! |
| 145 | * @define kOSMetaClassNoDicts |
| 146 | * @abstract Internal error: An allocation failure occurred |
| 147 | * registering Libkern C++ classes during kext loading. |
| 148 | */ |
| 149 | #define kOSMetaClassNoDicts libkern_metaclass_err(5) |
| 150 | // Allocation failure for Metaclass internal dictionaries |
| 151 | |
| 152 | /*! |
| 153 | * @define kOSMetaClassNoKModSet |
| 154 | * @abstract Internal error: An allocation failure occurred |
| 155 | * registering Libkern C++ classes during kext loading. |
| 156 | */ |
| 157 | #define kOSMetaClassNoKModSet libkern_metaclass_err(6) |
| 158 | // Allocation failure for internal kmodule set |
| 159 | |
| 160 | /*! |
| 161 | * @define kOSMetaClassNoInsKModSet |
| 162 | * @abstract Internal error: An error occurred registering |
| 163 | * a specific Libkern C++ class during kext loading. |
| 164 | */ |
| 165 | #define kOSMetaClassNoInsKModSet libkern_metaclass_err(7) |
| 166 | // Can't insert the KMod set into the module dictionary |
| 167 | |
| 168 | /*! |
| 169 | * @define kOSMetaClassNoSuper |
| 170 | * @abstract Internal error: No superclass can be found |
| 171 | * for a specific Libkern C++ class during kext loading. |
| 172 | */ |
| 173 | #define kOSMetaClassNoSuper libkern_metaclass_err(8) |
| 174 | |
| 175 | /*! |
| 176 | * @define kOSMetaClassInstNoSuper |
| 177 | * @abstract Internal error: No superclass can be found when constructing |
| 178 | * an instance of a Libkern C++ class. |
| 179 | */ |
| 180 | #define kOSMetaClassInstNoSuper libkern_metaclass_err(9) |
| 181 | |
| 182 | /*! |
| 183 | * @define kOSMetaClassDuplicateClass |
| 184 | * @abstract A duplicate Libkern C++ classname was encountered |
| 185 | * during kext loading. |
| 186 | */ |
| 187 | #define kOSMetaClassDuplicateClass libkern_metaclass_err(10) |
| 188 | |
| 189 | /*! |
| 190 | * @define kOSMetaClassNoKext |
| 191 | * @abstract Internal error: The kext for a Libkern C++ class |
| 192 | * can't be found during kext loading. |
| 193 | */ |
| 194 | #define kOSMetaClassNoKext libkern_metaclass_err(11) |
| 195 | |
| 196 | __END_DECLS |
| 197 | |
| 198 | #endif /* ! __LIBKERN_OSRETURN_H */ |