1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40: #define EXPORT_BOOLEAN
41: #include <mach/boolean.h>
42: #include <mach/error.h>
43: #include <mach_error.h>
44: #include <errorlib.h>
45:
46: extern void __mach_error_map_compat (mach_error_t *);
47:
48: const char *
49: mach_error_type( err )
50: mach_error_t err;
51: {
52: int sub, system;
53:
54: __mach_error_map_compat( &err );
55:
56: sub = err_get_sub(err);
57: system = err_get_system(err);
58:
59: if (system > err_max_system
60: || sub >= errors[system].max_sub ) return( "(?/?)" );
61: return( errors[system].subsystem[sub].subsys_name );
62: }
63:
64: boolean_t mach_error_full_diag = FALSE;
65:
66: const char *
67: mach_error_string_int(mach_error_t err,
68: boolean_t * diag)
69: {
70: int sub, system, code;
71:
72: __mach_error_map_compat( &err );
73:
74: sub = err_get_sub(err);
75: system = err_get_system(err);
76: code = err_get_code(err);
77:
78: *diag = TRUE;
79:
80: if (system > err_max_system) return( "(?/?) unknown error system" );
81: if (sub >= errors[system].max_sub) return( errors[system].bad_sub );
82: if (code >= errors[system].subsystem[sub].max_code) return ( NO_SUCH_ERROR );
83:
84: *diag = mach_error_full_diag;
85: return( errors[system].subsystem[sub].codes[code] );
86: }
87:
88: const char *
89: mach_error_string( err )
90: mach_error_t err;
91: {
92: boolean_t diag;
93:
94: return mach_error_string_int( err, &diag );
95:
96: }