1 /* 2 * Copyright (c) 2003-2019 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 * @OSF_COPYRIGHT@ 30 */ 31 /* 32 * Mach Operating System 33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University 34 * All Rights Reserved. 35 * 36 * Permission to use, copy, modify and distribute this software and its 37 * documentation is hereby granted, provided that both the copyright 38 * notice and this permission notice appear in all copies of the 39 * software, derivative works or modified versions, and any portions 40 * thereof, and that both notices appear in supporting documentation. 41 * 42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45 * 46 * Carnegie Mellon requests users of this software to return to 47 * 48 * Software Distribution Coordinator or [email protected] 49 * School of Computer Science 50 * Carnegie Mellon University 51 * Pittsburgh PA 15213-3890 52 * 53 * any improvements or extensions that they make and grant Carnegie the 54 * rights to redistribute these changes. 55 */ 56 57 /* 58 * File: error_codes.c 59 * Author: Douglas Orr, Carnegie Mellon University 60 * Date: Mar, 1988 61 * 62 * Generic error code interface 63 */ 64 65 #include <TargetConditionals.h> 66 #include <mach/error.h> 67 #include "errorlib.h" 68 #if !TARGET_OS_DRIVERKIT 69 #include "err_libkern.sub" 70 #include "err_iokit.sub" 71 #endif // !TARGET_OS_DRIVERKIT 72 #include "err_ipc.sub" 73 #include "err_kern.sub" 74 #include "err_mach_ipc.sub" 75 #include "err_server.sub" 76 #include "err_us.sub" 77 #include "err_vm.sub" 78 79 const struct error_system _mach_errors[err_max_system + 1] = { 80 /* 0; err_kern */ 81 { 82 .max_sub = errlib_count(err_os_sub), 83 .bad_sub = "(operating system/?) unknown subsystem error", 84 .subsystem = err_os_sub, 85 }, 86 /* 1; err_us */ 87 { 88 .max_sub = errlib_count(err_us_sub), 89 .bad_sub = "(user space/?) unknown subsystem error", 90 .subsystem = err_us_sub, 91 }, 92 /* 2; err_server */ 93 { 94 .max_sub = errlib_count(err_server_sub), 95 .bad_sub = "(server/?) unknown subsystem error", 96 .subsystem = err_server_sub, 97 }, 98 /* 3 (& 3f); err_ipc */ 99 { 100 .max_sub = errlib_count(err_ipc_sub), 101 .bad_sub = "(ipc/?) unknown subsystem error", 102 .subsystem = err_ipc_sub, 103 }, 104 /* 4; err_mach_ipc */ 105 { 106 .max_sub = errlib_count(err_mach_ipc_sub), 107 .bad_sub = "(ipc/?) unknown subsystem error", 108 .subsystem = err_mach_ipc_sub, 109 }, 110 111 /* 0x05 */ errorlib_system_null, 112 /* 0x06 */ errorlib_system_null, 113 /* 0x07; err_vm */ 114 { 115 .max_sub = errlib_count(err_vm_sub), 116 .bad_sub = "(vm/?) unknown subsystem error", 117 .subsystem = err_vm_sub, 118 }, 119 /* 0x08 */ errorlib_system_null, /* 0x09 */ errorlib_system_null, 120 /* 0x0a */ errorlib_system_null, /* 0x0b */ errorlib_system_null, 121 /* 0x0c */ errorlib_system_null, /* 0x0d */ errorlib_system_null, 122 /* 0x0e */ errorlib_system_null, /* 0x0f */ errorlib_system_null, 123 124 /* 0x10 */ errorlib_system_null, /* 0x11 */ errorlib_system_null, 125 /* 0x12 */ errorlib_system_null, /* 0x13 */ errorlib_system_null, 126 /* 0x14 */ errorlib_system_null, /* 0x15 */ errorlib_system_null, 127 /* 0x16 */ errorlib_system_null, /* 0x17 */ errorlib_system_null, 128 /* 0x18 */ errorlib_system_null, /* 0x19 */ errorlib_system_null, 129 /* 0x1a */ errorlib_system_null, /* 0x1b */ errorlib_system_null, 130 /* 0x1c */ errorlib_system_null, /* 0x1d */ errorlib_system_null, 131 /* 0x1e */ errorlib_system_null, /* 0x1f */ errorlib_system_null, 132 133 /* 0x20 */ errorlib_system_null, /* 0x21 */ errorlib_system_null, 134 /* 0x22 */ errorlib_system_null, /* 0x23 */ errorlib_system_null, 135 /* 0x24 */ errorlib_system_null, /* 0x25 */ errorlib_system_null, 136 /* 0x26 */ errorlib_system_null, /* 0x27 */ errorlib_system_null, 137 /* 0x28 */ errorlib_system_null, /* 0x29 */ errorlib_system_null, 138 /* 0x2a */ errorlib_system_null, /* 0x2b */ errorlib_system_null, 139 /* 0x2c */ errorlib_system_null, /* 0x2d */ errorlib_system_null, 140 /* 0x2e */ errorlib_system_null, /* 0x2f */ errorlib_system_null, 141 142 /* 0x30 */ errorlib_system_null, /* 0x31 */ errorlib_system_null, 143 /* 0x32 */ errorlib_system_null, /* 0x33 */ errorlib_system_null, 144 /* 0x34 */ errorlib_system_null, /* 0x35 */ errorlib_system_null, 145 /* 0x36 */ errorlib_system_null, 146 147 #if !TARGET_OS_DRIVERKIT 148 /* 0x37; err_libkern */ 149 { 150 .max_sub = errlib_count(err_libkern_sub), 151 .bad_sub = "(libkern/?) unknown subsystem error", 152 .subsystem = err_libkern_sub, 153 }, 154 155 /* 0x38; err_iokit */ 156 { 157 .max_sub = errlib_count(err_iokit_sub), 158 .bad_sub = "(iokit/?) unknown subsystem error", 159 .subsystem = err_iokit_sub, 160 .map_table = err_iokit_sub_map, 161 .map_count = errlib_count(err_iokit_sub_map) 162 }, 163 #else 164 /* 0x37 */ errorlib_system_null, /* 0x38 */ errorlib_system_null, 165 #endif // TARGET_OS_DRIVERKIT 166 167 /* 0x39 */ errorlib_system_null, 168 /* 0x3a */ errorlib_system_null, /* 0x3b */ errorlib_system_null, 169 /* 0x3c */ errorlib_system_null, /* 0x3d */ errorlib_system_null, 170 /* 0x3e */ errorlib_system_null, /* 0x3f */ errorlib_system_null, 171 }; 172 173 // int error_system_count = errlib_count(_mach_errors); 174