1 /* err_hurd added by roland@gnu.ai.mit.edu for GNU Hurd.
3 * Mach Operating System
4 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
15 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie Mellon
25 * the rights to redistribute these changes.
30 * Revision 1.1 1993/12/17 21:40:28 roland
33 * Revision 2.6 93/01/14 17:41:31 danner
34 * Standardized include symbol name.
37 * Revision 2.5 92/03/31 15:18:11 rpd
38 * Added err_bootstrap for bootstrap errors.
41 * Revision 2.4 91/05/14 16:51:24 mrt
42 * Correcting copyright
44 * Revision 2.3 91/02/05 17:31:48 mrt
45 * Changed to new Mach copyright
46 * [91/02/01 17:16:50 mrt]
48 * Revision 2.2 90/06/02 14:57:47 rpd
49 * Added err_mach_ipc for new IPC.
50 * [90/03/26 22:28:42 rpd]
52 * Revision 2.1 89/08/03 16:02:07 rwd
55 * Revision 2.4 89/02/25 18:13:18 gm0w
56 * Changes for cleanup.
58 * Revision 2.3 89/02/07 00:51:57 mwyoung
59 * Relocated from sys/error.h
61 * Revision 2.2 88/10/18 00:37:31 mwyoung
62 * Added {system,sub and code}_emask
63 * [88/10/17 17:06:58 mrt]
65 * Added {system,sub and code}_emask
67 * 12-May-88 Mary Thompson (mrt) at Carnegie Mellon
68 * Changed mach_error_t from unsigned int to kern_return_t
69 * which is a 32 bit integer regardless of machine type.
70 * insigned int was incompatible with old usages of mach_error.
72 * 10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University
73 * Missing endif replaced
75 * 5-May-88 Mary Thompson (mrt) at Carnegie Mellon
76 * Changed typedef of mach_error_t from long to unsigned int
77 * to keep our Camelot users happy. Also moved the nonkernel
78 * function declarations from here to mach_error.h.
80 * 10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
87 * error module definitions
91 #ifndef _MACH_ERROR_H_
92 #define _MACH_ERROR_H_
93 #include <mach/kern_return.h>
96 * error number layout as follows:
99 * | system(6) | subsystem(12) | code(14) |
103 #define err_none (mach_error_t)0
104 #define ERR_SUCCESS (mach_error_t)0
105 #define ERR_ROUTINE_NIL (mach_error_fn_t)0
108 #define err_system(x) (((x)&0x3f)<<26)
109 #define err_sub(x) (((x)&0xfff)<<14)
111 #define err_get_system(err) (((err)>>26)&0x3f)
112 #define err_get_sub(err) (((err)>>14)&0xfff)
113 #define err_get_code(err) ((err)&0x3fff)
115 #define system_emask (err_system(0x3f))
116 #define sub_emask (err_sub(0xfff))
117 #define code_emask (0x3fff)
120 /* major error systems */
121 #define err_kern err_system(0x0) /* kernel */
122 #define err_us err_system(0x1) /* user space library */
123 #define err_server err_system(0x2) /* user space servers */
124 #define err_ipc err_system(0x3) /* old ipc errors */
125 #define err_mach_ipc err_system(0x4) /* mach-ipc errors */
126 #define err_bootstrap err_system(0x5) /* bootstrap errors */
127 #define err_hurd err_system(0x10) /* GNU Hurd server errors */
128 #define err_local err_system(0x3e) /* user defined errors */
129 #define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */
131 #define err_max_system 0x3f
134 /* unix errors get lumped into one subsystem */
135 #define unix_err(errno) (err_kern|err_sub(3)|errno)
137 typedef kern_return_t mach_error_t;
138 typedef mach_error_t (* mach_error_fn_t)();
140 #endif /* _MACH_ERROR_H_ */