2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:29 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
32 * Import of OSF Mach kernel (~mburg)
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]
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]
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]
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]
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]
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]
59 * Revision 1.1 1992/09/30 02:30:35 robert
66 * Revision 2.4 91/05/14 16:51:24 mrt
67 * Correcting copyright
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]
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]
77 * Revision 2.1 89/08/03 16:02:07 rwd
80 * Revision 2.4 89/02/25 18:13:18 gm0w
81 * Changes for cleanup.
83 * Revision 2.3 89/02/07 00:51:57 mwyoung
84 * Relocated from sys/error.h
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]
90 * Added {system,sub and code}_emask
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.
97 * 10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University
98 * Missing endif replaced
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.
105 * 10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
111 * Mach Operating System
112 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
113 * All Rights Reserved.
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.
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.
125 * Carnegie Mellon requests users of this software to return to
127 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
128 * School of Computer Science
129 * Carnegie Mellon University
130 * Pittsburgh PA 15213-3890
132 * any improvements or extensions that they make and grant Carnegie Mellon
133 * the rights to redistribute these changes.
140 * error module definitions
146 #include <mach/kern_return.h>
149 * error number layout as follows:
152 * | system(6) | subsystem(12) | code(14) |
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
161 #define err_system(x) (((x)&0x3f)<<26)
162 #define err_sub(x) (((x)&0xfff)<<14)
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)
168 #define system_emask (err_system(0x3f))
169 #define sub_emask (err_sub(0xfff))
170 #define code_emask (0x3fff)
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 */
183 #define err_max_system 0x3f
186 /* unix errors get lumped into one subsystem */
187 #define unix_err(errno) (err_kern|err_sub(3)|errno)
189 typedef kern_return_t mach_error_t
;
190 typedef mach_error_t (* mach_error_fn_t
)( void );
192 #endif /* ERROR_H_ */