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