2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
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.
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.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
29 * Revision 1.1 1993/11/30 17:35:58 roland
32 * Revision 2.3 92/04/01 19:38:18 rpd
33 * Updated do_compat for kernel device errors,
34 * bootstrap file-system errors.
37 * Revision 2.2 92/02/20 15:58:08 elf
38 * Created from mach_error.c.
43 #define EXPORT_BOOLEAN
44 #include <mach/boolean.h>
45 #include <mach/error.h>
46 #include <mach_error.h>
49 extern void __mach_error_map_compat (mach_error_t
*);
52 mach_error_type( err
)
57 __mach_error_map_compat( &err
);
59 sub
= err_get_sub(err
);
60 system
= err_get_system(err
);
62 if (system
> err_max_system
63 || sub
>= errors
[system
].max_sub
) return( "(?/?)" );
64 return( errors
[system
].subsystem
[sub
].subsys_name
);
67 boolean_t mach_error_full_diag
= FALSE
;
70 mach_error_string_int( err
, diag
)
74 int sub
, system
, code
;
76 __mach_error_map_compat( &err
);
78 sub
= err_get_sub(err
);
79 system
= err_get_system(err
);
80 code
= err_get_code(err
);
84 if (system
> err_max_system
) return( "(?/?) unknown error system" );
85 if (sub
>= errors
[system
].max_sub
) return( errors
[system
].bad_sub
);
86 if (code
>= errors
[system
].subsystem
[sub
].max_code
) return ( NO_SUCH_ERROR
);
88 *diag
= mach_error_full_diag
;
89 return( errors
[system
].subsystem
[sub
].codes
[code
] );
93 mach_error_string( err
)
98 return mach_error_string_int( err
, &diag
);