1*bbb1b6f9SApple OSS Distributions /* 2*bbb1b6f9SApple OSS Distributions * Copyright (c) 2003-2019 Apple Inc. All rights reserved. 3*bbb1b6f9SApple OSS Distributions * 4*bbb1b6f9SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*bbb1b6f9SApple OSS Distributions * 6*bbb1b6f9SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*bbb1b6f9SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*bbb1b6f9SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*bbb1b6f9SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*bbb1b6f9SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*bbb1b6f9SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*bbb1b6f9SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*bbb1b6f9SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*bbb1b6f9SApple OSS Distributions * 15*bbb1b6f9SApple OSS Distributions * Please obtain a copy of the License at 16*bbb1b6f9SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*bbb1b6f9SApple OSS Distributions * 18*bbb1b6f9SApple OSS Distributions * The Original Code and all software distributed under the License are 19*bbb1b6f9SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*bbb1b6f9SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*bbb1b6f9SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*bbb1b6f9SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*bbb1b6f9SApple OSS Distributions * Please see the License for the specific language governing rights and 24*bbb1b6f9SApple OSS Distributions * limitations under the License. 25*bbb1b6f9SApple OSS Distributions * 26*bbb1b6f9SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*bbb1b6f9SApple OSS Distributions */ 28*bbb1b6f9SApple OSS Distributions /* 29*bbb1b6f9SApple OSS Distributions * @OSF_COPYRIGHT@ 30*bbb1b6f9SApple OSS Distributions */ 31*bbb1b6f9SApple OSS Distributions /* 32*bbb1b6f9SApple OSS Distributions * Mach Operating System 33*bbb1b6f9SApple OSS Distributions * Copyright (c) 1991,1990,1989 Carnegie Mellon University 34*bbb1b6f9SApple OSS Distributions * All Rights Reserved. 35*bbb1b6f9SApple OSS Distributions * 36*bbb1b6f9SApple OSS Distributions * Permission to use, copy, modify and distribute this software and its 37*bbb1b6f9SApple OSS Distributions * documentation is hereby granted, provided that both the copyright 38*bbb1b6f9SApple OSS Distributions * notice and this permission notice appear in all copies of the 39*bbb1b6f9SApple OSS Distributions * software, derivative works or modified versions, and any portions 40*bbb1b6f9SApple OSS Distributions * thereof, and that both notices appear in supporting documentation. 41*bbb1b6f9SApple OSS Distributions * 42*bbb1b6f9SApple OSS Distributions * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 43*bbb1b6f9SApple OSS Distributions * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44*bbb1b6f9SApple OSS Distributions * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45*bbb1b6f9SApple OSS Distributions * 46*bbb1b6f9SApple OSS Distributions * Carnegie Mellon requests users of this software to return to 47*bbb1b6f9SApple OSS Distributions * 48*bbb1b6f9SApple OSS Distributions * Software Distribution Coordinator or [email protected] 49*bbb1b6f9SApple OSS Distributions * School of Computer Science 50*bbb1b6f9SApple OSS Distributions * Carnegie Mellon University 51*bbb1b6f9SApple OSS Distributions * Pittsburgh PA 15213-3890 52*bbb1b6f9SApple OSS Distributions * 53*bbb1b6f9SApple OSS Distributions * any improvements or extensions that they make and grant Carnegie the 54*bbb1b6f9SApple OSS Distributions * rights to redistribute these changes. 55*bbb1b6f9SApple OSS Distributions */ 56*bbb1b6f9SApple OSS Distributions 57*bbb1b6f9SApple OSS Distributions /* 58*bbb1b6f9SApple OSS Distributions * File: error_codes.c 59*bbb1b6f9SApple OSS Distributions * Author: Douglas Orr, Carnegie Mellon University 60*bbb1b6f9SApple OSS Distributions * Date: Mar, 1988 61*bbb1b6f9SApple OSS Distributions * 62*bbb1b6f9SApple OSS Distributions * Generic error code interface 63*bbb1b6f9SApple OSS Distributions */ 64*bbb1b6f9SApple OSS Distributions 65*bbb1b6f9SApple OSS Distributions #include <TargetConditionals.h> 66*bbb1b6f9SApple OSS Distributions #include <mach/error.h> 67*bbb1b6f9SApple OSS Distributions #include "errorlib.h" 68*bbb1b6f9SApple OSS Distributions #if !TARGET_OS_DRIVERKIT 69*bbb1b6f9SApple OSS Distributions #include "err_libkern.sub" 70*bbb1b6f9SApple OSS Distributions #include "err_iokit.sub" 71*bbb1b6f9SApple OSS Distributions #endif // !TARGET_OS_DRIVERKIT 72*bbb1b6f9SApple OSS Distributions #include "err_ipc.sub" 73*bbb1b6f9SApple OSS Distributions #include "err_kern.sub" 74*bbb1b6f9SApple OSS Distributions #include "err_mach_ipc.sub" 75*bbb1b6f9SApple OSS Distributions #include "err_server.sub" 76*bbb1b6f9SApple OSS Distributions #include "err_us.sub" 77*bbb1b6f9SApple OSS Distributions #include "err_vm.sub" 78*bbb1b6f9SApple OSS Distributions 79*bbb1b6f9SApple OSS Distributions const struct error_system _mach_errors[err_max_system + 1] = { 80*bbb1b6f9SApple OSS Distributions /* 0; err_kern */ 81*bbb1b6f9SApple OSS Distributions { 82*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_os_sub), 83*bbb1b6f9SApple OSS Distributions .bad_sub = "(operating system/?) unknown subsystem error", 84*bbb1b6f9SApple OSS Distributions .subsystem = err_os_sub, 85*bbb1b6f9SApple OSS Distributions }, 86*bbb1b6f9SApple OSS Distributions /* 1; err_us */ 87*bbb1b6f9SApple OSS Distributions { 88*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_us_sub), 89*bbb1b6f9SApple OSS Distributions .bad_sub = "(user space/?) unknown subsystem error", 90*bbb1b6f9SApple OSS Distributions .subsystem = err_us_sub, 91*bbb1b6f9SApple OSS Distributions }, 92*bbb1b6f9SApple OSS Distributions /* 2; err_server */ 93*bbb1b6f9SApple OSS Distributions { 94*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_server_sub), 95*bbb1b6f9SApple OSS Distributions .bad_sub = "(server/?) unknown subsystem error", 96*bbb1b6f9SApple OSS Distributions .subsystem = err_server_sub, 97*bbb1b6f9SApple OSS Distributions }, 98*bbb1b6f9SApple OSS Distributions /* 3 (& 3f); err_ipc */ 99*bbb1b6f9SApple OSS Distributions { 100*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_ipc_sub), 101*bbb1b6f9SApple OSS Distributions .bad_sub = "(ipc/?) unknown subsystem error", 102*bbb1b6f9SApple OSS Distributions .subsystem = err_ipc_sub, 103*bbb1b6f9SApple OSS Distributions }, 104*bbb1b6f9SApple OSS Distributions /* 4; err_mach_ipc */ 105*bbb1b6f9SApple OSS Distributions { 106*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_mach_ipc_sub), 107*bbb1b6f9SApple OSS Distributions .bad_sub = "(ipc/?) unknown subsystem error", 108*bbb1b6f9SApple OSS Distributions .subsystem = err_mach_ipc_sub, 109*bbb1b6f9SApple OSS Distributions }, 110*bbb1b6f9SApple OSS Distributions 111*bbb1b6f9SApple OSS Distributions /* 0x05 */ errorlib_system_null, 112*bbb1b6f9SApple OSS Distributions /* 0x06 */ errorlib_system_null, 113*bbb1b6f9SApple OSS Distributions /* 0x07; err_vm */ 114*bbb1b6f9SApple OSS Distributions { 115*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_vm_sub), 116*bbb1b6f9SApple OSS Distributions .bad_sub = "(vm/?) unknown subsystem error", 117*bbb1b6f9SApple OSS Distributions .subsystem = err_vm_sub, 118*bbb1b6f9SApple OSS Distributions }, 119*bbb1b6f9SApple OSS Distributions /* 0x08 */ errorlib_system_null, /* 0x09 */ errorlib_system_null, 120*bbb1b6f9SApple OSS Distributions /* 0x0a */ errorlib_system_null, /* 0x0b */ errorlib_system_null, 121*bbb1b6f9SApple OSS Distributions /* 0x0c */ errorlib_system_null, /* 0x0d */ errorlib_system_null, 122*bbb1b6f9SApple OSS Distributions /* 0x0e */ errorlib_system_null, /* 0x0f */ errorlib_system_null, 123*bbb1b6f9SApple OSS Distributions 124*bbb1b6f9SApple OSS Distributions /* 0x10 */ errorlib_system_null, /* 0x11 */ errorlib_system_null, 125*bbb1b6f9SApple OSS Distributions /* 0x12 */ errorlib_system_null, /* 0x13 */ errorlib_system_null, 126*bbb1b6f9SApple OSS Distributions /* 0x14 */ errorlib_system_null, /* 0x15 */ errorlib_system_null, 127*bbb1b6f9SApple OSS Distributions /* 0x16 */ errorlib_system_null, /* 0x17 */ errorlib_system_null, 128*bbb1b6f9SApple OSS Distributions /* 0x18 */ errorlib_system_null, /* 0x19 */ errorlib_system_null, 129*bbb1b6f9SApple OSS Distributions /* 0x1a */ errorlib_system_null, /* 0x1b */ errorlib_system_null, 130*bbb1b6f9SApple OSS Distributions /* 0x1c */ errorlib_system_null, /* 0x1d */ errorlib_system_null, 131*bbb1b6f9SApple OSS Distributions /* 0x1e */ errorlib_system_null, /* 0x1f */ errorlib_system_null, 132*bbb1b6f9SApple OSS Distributions 133*bbb1b6f9SApple OSS Distributions /* 0x20 */ errorlib_system_null, /* 0x21 */ errorlib_system_null, 134*bbb1b6f9SApple OSS Distributions /* 0x22 */ errorlib_system_null, /* 0x23 */ errorlib_system_null, 135*bbb1b6f9SApple OSS Distributions /* 0x24 */ errorlib_system_null, /* 0x25 */ errorlib_system_null, 136*bbb1b6f9SApple OSS Distributions /* 0x26 */ errorlib_system_null, /* 0x27 */ errorlib_system_null, 137*bbb1b6f9SApple OSS Distributions /* 0x28 */ errorlib_system_null, /* 0x29 */ errorlib_system_null, 138*bbb1b6f9SApple OSS Distributions /* 0x2a */ errorlib_system_null, /* 0x2b */ errorlib_system_null, 139*bbb1b6f9SApple OSS Distributions /* 0x2c */ errorlib_system_null, /* 0x2d */ errorlib_system_null, 140*bbb1b6f9SApple OSS Distributions /* 0x2e */ errorlib_system_null, /* 0x2f */ errorlib_system_null, 141*bbb1b6f9SApple OSS Distributions 142*bbb1b6f9SApple OSS Distributions /* 0x30 */ errorlib_system_null, /* 0x31 */ errorlib_system_null, 143*bbb1b6f9SApple OSS Distributions /* 0x32 */ errorlib_system_null, /* 0x33 */ errorlib_system_null, 144*bbb1b6f9SApple OSS Distributions /* 0x34 */ errorlib_system_null, /* 0x35 */ errorlib_system_null, 145*bbb1b6f9SApple OSS Distributions /* 0x36 */ errorlib_system_null, 146*bbb1b6f9SApple OSS Distributions 147*bbb1b6f9SApple OSS Distributions #if !TARGET_OS_DRIVERKIT 148*bbb1b6f9SApple OSS Distributions /* 0x37; err_libkern */ 149*bbb1b6f9SApple OSS Distributions { 150*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_libkern_sub), 151*bbb1b6f9SApple OSS Distributions .bad_sub = "(libkern/?) unknown subsystem error", 152*bbb1b6f9SApple OSS Distributions .subsystem = err_libkern_sub, 153*bbb1b6f9SApple OSS Distributions }, 154*bbb1b6f9SApple OSS Distributions 155*bbb1b6f9SApple OSS Distributions /* 0x38; err_iokit */ 156*bbb1b6f9SApple OSS Distributions { 157*bbb1b6f9SApple OSS Distributions .max_sub = errlib_count(err_iokit_sub), 158*bbb1b6f9SApple OSS Distributions .bad_sub = "(iokit/?) unknown subsystem error", 159*bbb1b6f9SApple OSS Distributions .subsystem = err_iokit_sub, 160*bbb1b6f9SApple OSS Distributions .map_table = err_iokit_sub_map, 161*bbb1b6f9SApple OSS Distributions .map_count = errlib_count(err_iokit_sub_map) 162*bbb1b6f9SApple OSS Distributions }, 163*bbb1b6f9SApple OSS Distributions #else 164*bbb1b6f9SApple OSS Distributions /* 0x37 */ errorlib_system_null, /* 0x38 */ errorlib_system_null, 165*bbb1b6f9SApple OSS Distributions #endif // TARGET_OS_DRIVERKIT 166*bbb1b6f9SApple OSS Distributions 167*bbb1b6f9SApple OSS Distributions /* 0x39 */ errorlib_system_null, 168*bbb1b6f9SApple OSS Distributions /* 0x3a */ errorlib_system_null, /* 0x3b */ errorlib_system_null, 169*bbb1b6f9SApple OSS Distributions /* 0x3c */ errorlib_system_null, /* 0x3d */ errorlib_system_null, 170*bbb1b6f9SApple OSS Distributions /* 0x3e */ errorlib_system_null, /* 0x3f */ errorlib_system_null, 171*bbb1b6f9SApple OSS Distributions }; 172*bbb1b6f9SApple OSS Distributions 173*bbb1b6f9SApple OSS Distributions // int error_system_count = errlib_count(_mach_errors); 174