]>
Commit | Line | Data |
---|---|---|
28f540f4 RM |
1 | /* |
2 | * Mach Operating System | |
3 | * Copyright (c) 1991,1990,1989 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$ | |
0d8733c4 UD |
29 | * Revision 1.2 1997/03/16 17:41:48 drepper |
30 | * (mach_error_string_int): Give full prototype. | |
31 | * | |
32 | * Revision 1.2 1997/03/14 15:26:29 thomas | |
33 | * Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> | |
34 | * | |
35 | * * mach/mach_error.c (mach_error_string_int): Give full prototype. | |
36 | * * mach/errstring.c (mach_error_string_int): Likewise. | |
37 | * * mach/error_compat.c (__mach_error_map_compat): Likewise. | |
38 | * | |
39 | * * mach/spin-solid.c: Include <mach/mach_traps.h>. | |
40 | * * mach/spin-solid.c (__spin_lock_solid): Provide arg to | |
41 | * swtch_pri. | |
42 | * | |
43 | * * mach/mach_init.c: Include <mach/mig_support.h>. | |
44 | * | |
45 | * * mach/mach_error.h (mach_error_string, mach_error, | |
46 | * mach_error_type): Always provide prototypes. | |
47 | * | |
28f540f4 RM |
48 | * Revision 1.1 1993/11/30 17:35:58 roland |
49 | * entered into RCS | |
50 | * | |
51 | * Revision 2.3 92/04/01 19:38:18 rpd | |
52 | * Updated do_compat for kernel device errors, | |
53 | * bootstrap file-system errors. | |
54 | * [92/03/09 rpd] | |
55 | * | |
56 | * Revision 2.2 92/02/20 15:58:08 elf | |
57 | * Created from mach_error.c. | |
58 | * [92/02/11 rpd] | |
59 | * | |
60 | */ | |
61 | ||
62 | #define EXPORT_BOOLEAN | |
63 | #include <mach/boolean.h> | |
64 | #include <mach/error.h> | |
65 | #include <mach_error.h> | |
66 | #include <errorlib.h> | |
67 | ||
68 | extern void __mach_error_map_compat (mach_error_t *); | |
69 | ||
70 | const char * | |
71 | mach_error_type( err ) | |
72 | mach_error_t err; | |
73 | { | |
74 | int sub, system; | |
75 | ||
76 | __mach_error_map_compat( &err ); | |
77 | ||
78 | sub = err_get_sub(err); | |
79 | system = err_get_system(err); | |
80 | ||
81 | if (system > err_max_system | |
82 | || sub >= errors[system].max_sub ) return( "(?/?)" ); | |
83 | return( errors[system].subsystem[sub].subsys_name ); | |
84 | } | |
85 | ||
86 | boolean_t mach_error_full_diag = FALSE; | |
87 | ||
88 | const char * | |
0d8733c4 UD |
89 | mach_error_string_int(mach_error_t err, |
90 | boolean_t * diag) | |
28f540f4 RM |
91 | { |
92 | int sub, system, code; | |
93 | ||
94 | __mach_error_map_compat( &err ); | |
95 | ||
96 | sub = err_get_sub(err); | |
97 | system = err_get_system(err); | |
98 | code = err_get_code(err); | |
99 | ||
100 | *diag = TRUE; | |
101 | ||
102 | if (system > err_max_system) return( "(?/?) unknown error system" ); | |
103 | if (sub >= errors[system].max_sub) return( errors[system].bad_sub ); | |
104 | if (code >= errors[system].subsystem[sub].max_code) return ( NO_SUCH_ERROR ); | |
105 | ||
106 | *diag = mach_error_full_diag; | |
107 | return( errors[system].subsystem[sub].codes[code] ); | |
108 | } | |
109 | ||
110 | const char * | |
111 | mach_error_string( err ) | |
112 | mach_error_t err; | |
113 | { | |
114 | boolean_t diag; | |
115 | ||
116 | return mach_error_string_int( err, &diag ); | |
117 | ||
118 | } |