]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/error.h
xnu-517.12.7.tar.gz
[apple/xnu.git] / osfmk / mach / error.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * HISTORY
27 *
28 * Revision 1.1.1.1 1998/09/22 21:05:29 wsanchez
29 * Import of Mac OS X kernel (~semeria)
30 *
31 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
32 * Import of OSF Mach kernel (~mburg)
33 *
34 * Revision 1.2.10.2 1995/02/23 17:51:15 alanl
35 * Merge with DIPC2_SHARED.
36 * [1995/01/03 21:49:04 alanl]
37 *
38 * Revision 1.2.10.1 1994/09/23 02:35:28 ezf
39 * change marker to not FREE
40 * [1994/09/22 21:39:26 ezf]
41 *
42 * Revision 1.2.8.1 1994/08/04 02:27:36 mmp
43 * NOTE: file was moved back to b11 version for dipc2_shared.
44 * Added DIPC error system.
45 * [1994/05/11 17:36:37 alanl]
46 *
47 * Revision 1.2.2.3 1993/08/12 21:59:50 jvs
48 * Correctly prototype mach_error_fn_t typedef. 9523
49 * [1993/08/12 21:57:56 jvs]
50 *
51 * Revision 1.2.2.2 1993/06/09 02:39:58 gm
52 * Added to OSF/1 R1.3 from NMK15.0.
53 * [1993/06/02 21:15:47 jeffc]
54 *
55 * Revision 1.2 1993/04/19 16:33:02 devrcs
56 * make endif tags ansi compliant/include files
57 * [1993/02/20 21:44:37 david]
58 *
59 * Revision 1.1 1992/09/30 02:30:35 robert
60 * Initial revision
61 *
62 * $EndLog$
63 */
64 /* CMU_HIST */
65 /*
66 * Revision 2.4 91/05/14 16:51:24 mrt
67 * Correcting copyright
68 *
69 * Revision 2.3 91/02/05 17:31:48 mrt
70 * Changed to new Mach copyright
71 * [91/02/01 17:16:50 mrt]
72 *
73 * Revision 2.2 90/06/02 14:57:47 rpd
74 * Added err_mach_ipc for new IPC.
75 * [90/03/26 22:28:42 rpd]
76 *
77 * Revision 2.1 89/08/03 16:02:07 rwd
78 * Created.
79 *
80 * Revision 2.4 89/02/25 18:13:18 gm0w
81 * Changes for cleanup.
82 *
83 * Revision 2.3 89/02/07 00:51:57 mwyoung
84 * Relocated from sys/error.h
85 *
86 * Revision 2.2 88/10/18 00:37:31 mwyoung
87 * Added {system,sub and code}_emask
88 * [88/10/17 17:06:58 mrt]
89 *
90 * Added {system,sub and code}_emask
91 *
92 * 12-May-88 Mary Thompson (mrt) at Carnegie Mellon
93 * Changed mach_error_t from unsigned int to kern_return_t
94 * which is a 32 bit integer regardless of machine type.
95 * insigned int was incompatible with old usages of mach_error.
96 *
97 * 10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University
98 * Missing endif replaced
99 *
100 * 5-May-88 Mary Thompson (mrt) at Carnegie Mellon
101 * Changed typedef of mach_error_t from long to unsigned int
102 * to keep our Camelot users happy. Also moved the nonkernel
103 * function declarations from here to mach_error.h.
104 *
105 * 10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
106 * Created.
107 *
108 */
109 /* CMU_ENDHIST */
110 /*
111 * Mach Operating System
112 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
113 * All Rights Reserved.
114 *
115 * Permission to use, copy, modify and distribute this software and its
116 * documentation is hereby granted, provided that both the copyright
117 * notice and this permission notice appear in all copies of the
118 * software, derivative works or modified versions, and any portions
119 * thereof, and that both notices appear in supporting documentation.
120 *
121 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
122 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
123 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
124 *
125 * Carnegie Mellon requests users of this software to return to
126 *
127 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
128 * School of Computer Science
129 * Carnegie Mellon University
130 * Pittsburgh PA 15213-3890
131 *
132 * any improvements or extensions that they make and grant Carnegie Mellon
133 * the rights to redistribute these changes.
134 */
135 /*
136 */
137 /*
138 * File: mach/error.h
139 * Purpose:
140 * error module definitions
141 *
142 */
143
144 #ifndef ERROR_H_
145 #define ERROR_H_
146 #include <mach/kern_return.h>
147
148 /*
149 * error number layout as follows:
150 *
151 * hi lo
152 * | system(6) | subsystem(12) | code(14) |
153 */
154
155
156 #define err_none (mach_error_t)0
157 #define ERR_SUCCESS (mach_error_t)0
158 #define ERR_ROUTINE_NIL (mach_error_fn_t)0
159
160
161 #define err_system(x) (((x)&0x3f)<<26)
162 #define err_sub(x) (((x)&0xfff)<<14)
163
164 #define err_get_system(err) (((err)>>26)&0x3f)
165 #define err_get_sub(err) (((err)>>14)&0xfff)
166 #define err_get_code(err) ((err)&0x3fff)
167
168 #define system_emask (err_system(0x3f))
169 #define sub_emask (err_sub(0xfff))
170 #define code_emask (0x3fff)
171
172
173 /* major error systems */
174 #define err_kern err_system(0x0) /* kernel */
175 #define err_us err_system(0x1) /* user space library */
176 #define err_server err_system(0x2) /* user space servers */
177 #define err_ipc err_system(0x3) /* old ipc errors */
178 #define err_mach_ipc err_system(0x4) /* mach-ipc errors */
179 #define err_dipc err_system(0x7) /* distributed ipc */
180 #define err_local err_system(0x3e) /* user defined errors */
181 #define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */
182
183 #define err_max_system 0x3f
184
185
186 /* unix errors get lumped into one subsystem */
187 #define unix_err(errno) (err_kern|err_sub(3)|errno)
188
189 typedef kern_return_t mach_error_t;
190 typedef mach_error_t (* mach_error_fn_t)( void );
191
192 #endif /* ERROR_H_ */