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 #ifdef XNU_KERNEL_PRIVATE 76 /********************************************************************* 77 * Check libsyscall/mach/err_libkern.sub when editing or adding 78 * result codes! 79 *********************************************************************/ 80 #endif /* XNU_KERNEL_PRIVATE */ 81 82 /*! 83 * @typedef OSReturn 84 * @abstract The return type for many Libkern functions. 85 */ 86 typedef kern_return_t OSReturn; 87 88 #ifndef sys_libkern 89 #define sys_libkern err_system(0x37) 90 #endif /* sys_libkern */ 91 92 #define sub_libkern_common err_sub(0) 93 #define sub_libkern_metaclass err_sub(1) 94 #define sub_libkern_reserved err_sub(-1) 95 96 #define libkern_common_err(return ) (sys_libkern|sub_libkern_common|(return)) 97 #define libkern_metaclass_err(return ) (sys_libkern|sub_libkern_metaclass|(return)) 98 99 /* See OSKextLib.h for these 100 * #define sub_libkern_kext err_sub(2) 101 * #define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code)) 102 */ 103 104 /*! 105 * @define kOSReturnSuccess 106 * @abstract Operation successful. 107 * Equal to <code>@link //apple_ref/c/econst/KERN_SUCCESS 108 * KERN_SUCCESS@/link</code>. 109 */ 110 #define kOSReturnSuccess KERN_SUCCESS 111 112 /*! 113 * @define kOSReturnError 114 * @abstract Unspecified Libkern error. 115 * <b>Not equal</b> to 116 * <code>@link //apple_ref/c/econst/KERN_FAILURE 117 * KERN_FAILURE@/link</code>. 118 */ 119 #define kOSReturnError libkern_common_err(1) 120 121 /*! 122 * @define kOSMetaClassInternal 123 * @abstract Internal OSMetaClass run-time error. 124 */ 125 #define kOSMetaClassInternal libkern_metaclass_err(1) 126 127 /*! 128 * @define kOSMetaClassHasInstances 129 * @abstract A kext cannot be unloaded because there are instances 130 * derived from Libkern C++ classes that it defines. 131 */ 132 #define kOSMetaClassHasInstances libkern_metaclass_err(2) 133 134 /*! 135 * @define kOSMetaClassNoInit 136 * @abstract Internal error: The Libkern C++ class registration system 137 * was not properly initialized during kext loading. 138 */ 139 #define kOSMetaClassNoInit libkern_metaclass_err(3) 140 // OSMetaClass::preModLoad wasn't called, runtime internal error 141 142 /*! 143 * @define kOSMetaClassNoTempData 144 * @abstract Internal error: An allocation failure occurred 145 * registering Libkern C++ classes during kext loading. 146 */ 147 #define kOSMetaClassNoTempData libkern_metaclass_err(4) 148 // Allocation failure internal data 149 150 /*! 151 * @define kOSMetaClassNoDicts 152 * @abstract Internal error: An allocation failure occurred 153 * registering Libkern C++ classes during kext loading. 154 */ 155 #define kOSMetaClassNoDicts libkern_metaclass_err(5) 156 // Allocation failure for Metaclass internal dictionaries 157 158 /*! 159 * @define kOSMetaClassNoKModSet 160 * @abstract Internal error: An allocation failure occurred 161 * registering Libkern C++ classes during kext loading. 162 */ 163 #define kOSMetaClassNoKModSet libkern_metaclass_err(6) 164 // Allocation failure for internal kmodule set 165 166 /*! 167 * @define kOSMetaClassNoInsKModSet 168 * @abstract Internal error: An error occurred registering 169 * a specific Libkern C++ class during kext loading. 170 */ 171 #define kOSMetaClassNoInsKModSet libkern_metaclass_err(7) 172 // Can't insert the KMod set into the module dictionary 173 174 /*! 175 * @define kOSMetaClassNoSuper 176 * @abstract Internal error: No superclass can be found 177 * for a specific Libkern C++ class during kext loading. 178 */ 179 #define kOSMetaClassNoSuper libkern_metaclass_err(8) 180 181 /*! 182 * @define kOSMetaClassInstNoSuper 183 * @abstract Internal error: No superclass can be found when constructing 184 * an instance of a Libkern C++ class. 185 */ 186 #define kOSMetaClassInstNoSuper libkern_metaclass_err(9) 187 188 /*! 189 * @define kOSMetaClassDuplicateClass 190 * @abstract A duplicate Libkern C++ classname was encountered 191 * during kext loading. 192 */ 193 #define kOSMetaClassDuplicateClass libkern_metaclass_err(10) 194 195 /*! 196 * @define kOSMetaClassNoKext 197 * @abstract Internal error: The kext for a Libkern C++ class 198 * can't be found during kext loading. 199 */ 200 #define kOSMetaClassNoKext libkern_metaclass_err(11) 201 202 __END_DECLS 203 204 #endif /* ! __LIBKERN_OSRETURN_H */ 205