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