]>
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:42:02 drepper |
30 | * (mach_error_string_int): Give full prototype. | |
31 | * | |
32 | * Revision 1.2 1997/03/14 15:26:30 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 1992/10/06 18:29:54 roland |
49 | * entered into RCS | |
50 | * | |
51 | * Revision 2.4 92/02/19 15:10:52 elf | |
52 | * Moved mach_error_string and mach_error_type to mach_error_string.c. | |
53 | * [92/02/11 rpd] | |
54 | * | |
55 | * Revision 2.3 92/01/23 15:22:06 rpd | |
56 | * Changed <servers/errorlib.h> to <errorlib.h>. | |
57 | * [92/01/16 rpd] | |
58 | * | |
59 | * Revision 2.2 92/01/16 00:08:03 rpd | |
60 | * Moved from user collection to mk collection. | |
61 | * | |
62 | * Revision 2.3 91/08/29 15:51:50 rpd | |
63 | * Changed IPC_MIG_MOD to MACH_IPC_MIG_MOD, to get the new error strings. | |
64 | * [91/08/22 rpd] | |
65 | * | |
66 | * Revision 2.2 91/03/27 16:06:29 mrt | |
67 | * Changed include of "errorlib.h" to <servers/errorlib.h> | |
68 | * Added new copyright | |
69 | * [91/03/20 mrt] | |
70 | * | |
71 | */ | |
72 | /* | |
73 | * File: mach_error.c | |
74 | * Author: Douglas Orr, Carnegie Mellon University | |
75 | * Date: Mar 1988 | |
76 | * | |
77 | * interprets structured mach error codes and prints | |
78 | * or returns a descriptive string. | |
79 | */ | |
80 | ||
81 | #include <stdio.h> | |
82 | #include <mach_error.h> | |
83 | #include <mach/boolean.h> | |
84 | ||
0d8733c4 | 85 | extern char * mach_error_string_int(mach_error_t, boolean_t *); |
28f540f4 RM |
86 | |
87 | void | |
88 | mach_error( str, err ) | |
89 | char *str; | |
90 | mach_error_t err; | |
91 | { | |
92 | char * err_str; | |
93 | char buf[1024]; | |
94 | boolean_t diag; | |
95 | ||
96 | err_str=mach_error_string_int(err, &diag); | |
97 | ||
98 | if ( diag ) { | |
99 | sprintf( buf, "%s %s (%x)", mach_error_type(err), err_str, err ); | |
100 | err_str = buf; | |
101 | } | |
102 | ||
103 | fprintf(stderr, "%s %s\n", str, err_str); | |
104 | } |