1 | /* err_hurd added by roland@gnu.ai.mit.edu for GNU Hurd. |
2 | * |
3 | * Mach Operating System |
4 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University |
5 | * All Rights Reserved. |
6 | * |
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. |
12 | * |
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. |
16 | * |
17 | * Carnegie Mellon requests users of this software to return to |
18 | * |
19 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
20 | * School of Computer Science |
21 | * Carnegie Mellon University |
22 | * Pittsburgh PA 15213-3890 |
23 | * |
24 | * any improvements or extensions that they make and grant Carnegie Mellon |
25 | * the rights to redistribute these changes. |
26 | */ |
27 | /* |
28 | * (pre-GNU) HISTORY |
29 | * |
30 | * Revision 2.6 93/01/14 17:41:31 danner |
31 | * Standardized include symbol name. |
32 | * [92/06/10 pds] |
33 | * |
34 | * Revision 2.5 92/03/31 15:18:11 rpd |
35 | * Added err_bootstrap for bootstrap errors. |
36 | * [92/03/09 rpd] |
37 | * |
38 | * Revision 2.4 91/05/14 16:51:24 mrt |
39 | * Correcting copyright |
40 | * |
41 | * Revision 2.3 91/02/05 17:31:48 mrt |
42 | * Changed to new Mach copyright |
43 | * [91/02/01 17:16:50 mrt] |
44 | * |
45 | * Revision 2.2 90/06/02 14:57:47 rpd |
46 | * Added err_mach_ipc for new IPC. |
47 | * [90/03/26 22:28:42 rpd] |
48 | * |
49 | * Revision 2.1 89/08/03 16:02:07 rwd |
50 | * Created. |
51 | * |
52 | * Revision 2.4 89/02/25 18:13:18 gm0w |
53 | * Changes for cleanup. |
54 | * |
55 | * Revision 2.3 89/02/07 00:51:57 mwyoung |
56 | * Relocated from sys/error.h |
57 | * |
58 | * Revision 2.2 88/10/18 00:37:31 mwyoung |
59 | * Added {system,sub and code}_emask |
60 | * [88/10/17 17:06:58 mrt] |
61 | * |
62 | * Added {system,sub and code}_emask |
63 | * |
64 | * 12-May-88 Mary Thompson (mrt) at Carnegie Mellon |
65 | * Changed mach_error_t from unsigned int to kern_return_t |
66 | * which is a 32 bit integer regardless of machine type. |
67 | * unsigned int was incompatible with old usages of mach_error. |
68 | * |
69 | * 10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University |
70 | * Missing endif replaced |
71 | * |
72 | * 5-May-88 Mary Thompson (mrt) at Carnegie Mellon |
73 | * Changed typedef of mach_error_t from long to unsigned int |
74 | * to keep our Camelot users happy. Also moved the nonkernel |
75 | * function declarations from here to mach_error.h. |
76 | * |
77 | * 10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University |
78 | * Created. |
79 | * |
80 | */ |
81 | /* |
82 | * File: mach/error.h |
83 | * Purpose: |
84 | * error module definitions |
85 | * |
86 | */ |
87 | |
88 | #ifndef _MACH_ERROR_H_ |
89 | #define _MACH_ERROR_H_ |
90 | #include <mach/kern_return.h> |
91 | |
92 | /* |
93 | * error number layout as follows: |
94 | * |
95 | * hi lo |
96 | * | system(6) | subsystem(12) | code(14) | |
97 | */ |
98 | |
99 | |
100 | #define err_none (mach_error_t)0 |
101 | #define ERR_SUCCESS (mach_error_t)0 |
102 | #define ERR_ROUTINE_NIL (mach_error_fn_t)0 |
103 | |
104 | |
105 | #define err_system(x) (((x)&0x3f)<<26) |
106 | #define err_sub(x) (((x)&0xfff)<<14) |
107 | |
108 | #define err_get_system(err) (((err)>>26)&0x3f) |
109 | #define err_get_sub(err) (((err)>>14)&0xfff) |
110 | #define err_get_code(err) ((err)&0x3fff) |
111 | |
112 | #define system_emask (err_system(0x3f)) |
113 | #define sub_emask (err_sub(0xfff)) |
114 | #define code_emask (0x3fff) |
115 | |
116 | |
117 | /* major error systems */ |
118 | #define err_kern err_system(0x0) /* kernel */ |
119 | #define err_us err_system(0x1) /* user space library */ |
120 | #define err_server err_system(0x2) /* user space servers */ |
121 | #define err_ipc err_system(0x3) /* old ipc errors */ |
122 | #define err_mach_ipc err_system(0x4) /* mach-ipc errors */ |
123 | #define err_bootstrap err_system(0x5) /* bootstrap errors */ |
124 | #define err_hurd err_system(0x10) /* GNU Hurd server errors */ |
125 | #define err_local err_system(0x3e) /* user defined errors */ |
126 | #define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */ |
127 | |
128 | #define err_max_system 0x3f |
129 | |
130 | |
131 | /* unix errors get lumped into one subsystem */ |
132 | #define unix_err(errno) (err_kern|err_sub(3)|errno) |
133 | |
134 | typedef kern_return_t mach_error_t; |
135 | /* typedef mach_error_t (* mach_error_fn_t)(); */ |
136 | |
137 | #endif /* _MACH_ERROR_H_ */ |
138 | |