xref: /xnu-11215/libsyscall/mach/error_codes.c (revision a5e72196)
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 
78 const struct error_system _mach_errors[err_max_system + 1] = {
79 	/* 0; err_kern */
80 	{
81 		.max_sub = errlib_count(err_os_sub),
82 		.bad_sub = "(operating system/?) unknown subsystem error",
83 		.subsystem = err_os_sub,
84 	},
85 	/* 1; err_us */
86 	{
87 		.max_sub = errlib_count(err_us_sub),
88 		.bad_sub = "(user space/?) unknown subsystem error",
89 		.subsystem = err_us_sub,
90 	},
91 	/* 2; err_server */
92 	{
93 		.max_sub = errlib_count(err_server_sub),
94 		.bad_sub = "(server/?) unknown subsystem error",
95 		.subsystem = err_server_sub,
96 	},
97 	/* 3 (& 3f); err_ipc */
98 	{
99 		.max_sub = errlib_count(err_ipc_sub),
100 		.bad_sub = "(ipc/?) unknown subsystem error",
101 		.subsystem = err_ipc_sub,
102 	},
103 	/* 4; err_mach_ipc */
104 	{
105 		.max_sub = errlib_count(err_mach_ipc_sub),
106 		.bad_sub = "(ipc/?) unknown subsystem error",
107 		.subsystem = err_mach_ipc_sub,
108 	},
109 
110 	/* 0x05 */ errorlib_system_null,
111 	/* 0x06 */ errorlib_system_null, /* 0x07 */ errorlib_system_null,
112 	/* 0x08 */ errorlib_system_null, /* 0x09 */ errorlib_system_null,
113 	/* 0x0a */ errorlib_system_null, /* 0x0b */ errorlib_system_null,
114 	/* 0x0c */ errorlib_system_null, /* 0x0d */ errorlib_system_null,
115 	/* 0x0e */ errorlib_system_null, /* 0x0f */ errorlib_system_null,
116 
117 	/* 0x10 */ errorlib_system_null, /* 0x11 */ errorlib_system_null,
118 	/* 0x12 */ errorlib_system_null, /* 0x13 */ errorlib_system_null,
119 	/* 0x14 */ errorlib_system_null, /* 0x15 */ errorlib_system_null,
120 	/* 0x16 */ errorlib_system_null, /* 0x17 */ errorlib_system_null,
121 	/* 0x18 */ errorlib_system_null, /* 0x19 */ errorlib_system_null,
122 	/* 0x1a */ errorlib_system_null, /* 0x1b */ errorlib_system_null,
123 	/* 0x1c */ errorlib_system_null, /* 0x1d */ errorlib_system_null,
124 	/* 0x1e */ errorlib_system_null, /* 0x1f */ errorlib_system_null,
125 
126 	/* 0x20 */ errorlib_system_null, /* 0x21 */ errorlib_system_null,
127 	/* 0x22 */ errorlib_system_null, /* 0x23 */ errorlib_system_null,
128 	/* 0x24 */ errorlib_system_null, /* 0x25 */ errorlib_system_null,
129 	/* 0x26 */ errorlib_system_null, /* 0x27 */ errorlib_system_null,
130 	/* 0x28 */ errorlib_system_null, /* 0x29 */ errorlib_system_null,
131 	/* 0x2a */ errorlib_system_null, /* 0x2b */ errorlib_system_null,
132 	/* 0x2c */ errorlib_system_null, /* 0x2d */ errorlib_system_null,
133 	/* 0x2e */ errorlib_system_null, /* 0x2f */ errorlib_system_null,
134 
135 	/* 0x30 */ errorlib_system_null, /* 0x31 */ errorlib_system_null,
136 	/* 0x32 */ errorlib_system_null, /* 0x33 */ errorlib_system_null,
137 	/* 0x34 */ errorlib_system_null, /* 0x35 */ errorlib_system_null,
138 	/* 0x36 */ errorlib_system_null,
139 
140 #if !TARGET_OS_DRIVERKIT
141 	/* 0x37; err_libkern */
142 	{
143 		.max_sub = errlib_count(err_libkern_sub),
144 		.bad_sub = "(libkern/?) unknown subsystem error",
145 		.subsystem = err_libkern_sub,
146 	},
147 
148 	/* 0x38; err_iokit */
149 	{
150 		.max_sub = errlib_count(err_iokit_sub),
151 		.bad_sub = "(iokit/?) unknown subsystem error",
152 		.subsystem = err_iokit_sub,
153 		.map_table = err_iokit_sub_map,
154 		.map_count = errlib_count(err_iokit_sub_map)
155 	},
156 #else
157 	/* 0x37 */ errorlib_system_null, /* 0x38 */ errorlib_system_null,
158 #endif // TARGET_OS_DRIVERKIT
159 
160 	/* 0x39 */ errorlib_system_null,
161 	/* 0x3a */ errorlib_system_null, /* 0x3b */ errorlib_system_null,
162 	/* 0x3c */ errorlib_system_null, /* 0x3d */ errorlib_system_null,
163 	/* 0x3e */ errorlib_system_null, /* 0x3f */ errorlib_system_null,
164 };
165 
166 // int error_system_count = errlib_count(_mach_errors);
167