]>
Commit | Line | Data |
---|---|---|
eff75b8d | 1 | /* |
28f540f4 RM |
2 | * Mach Operating System |
3 | * Copyright (c) 1991,1990,1989 Carnegie Mellon University | |
4 | * All Rights Reserved. | |
eff75b8d | 5 | * |
28f540f4 RM |
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. | |
eff75b8d | 11 | * |
28f540f4 RM |
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. | |
eff75b8d | 15 | * |
28f540f4 | 16 | * Carnegie Mellon requests users of this software to return to |
eff75b8d | 17 | * |
28f540f4 RM |
18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
19 | * School of Computer Science | |
20 | * Carnegie Mellon University | |
21 | * Pittsburgh PA 15213-3890 | |
eff75b8d | 22 | * |
28f540f4 RM |
23 | * any improvements or extensions that they make and grant Carnegie Mellon |
24 | * the rights to redistribute these changes. | |
25 | */ | |
26 | /* | |
eff75b8d | 27 | * (pre-GNU) HISTORY |
28f540f4 RM |
28 | * |
29 | * Revision 2.4 92/02/19 15:10:52 elf | |
30 | * Moved mach_error_string and mach_error_type to mach_error_string.c. | |
31 | * [92/02/11 rpd] | |
eff75b8d | 32 | * |
28f540f4 RM |
33 | * Revision 2.3 92/01/23 15:22:06 rpd |
34 | * Changed <servers/errorlib.h> to <errorlib.h>. | |
35 | * [92/01/16 rpd] | |
eff75b8d | 36 | * |
28f540f4 RM |
37 | * Revision 2.2 92/01/16 00:08:03 rpd |
38 | * Moved from user collection to mk collection. | |
eff75b8d | 39 | * |
28f540f4 RM |
40 | * Revision 2.3 91/08/29 15:51:50 rpd |
41 | * Changed IPC_MIG_MOD to MACH_IPC_MIG_MOD, to get the new error strings. | |
42 | * [91/08/22 rpd] | |
eff75b8d | 43 | * |
28f540f4 RM |
44 | * Revision 2.2 91/03/27 16:06:29 mrt |
45 | * Changed include of "errorlib.h" to <servers/errorlib.h> | |
46 | * Added new copyright | |
47 | * [91/03/20 mrt] | |
eff75b8d | 48 | * |
28f540f4 RM |
49 | */ |
50 | /* | |
51 | * File: mach_error.c | |
52 | * Author: Douglas Orr, Carnegie Mellon University | |
53 | * Date: Mar 1988 | |
54 | * | |
55 | * interprets structured mach error codes and prints | |
56 | * or returns a descriptive string. | |
57 | */ | |
58 | ||
59 | #include <stdio.h> | |
60 | #include <mach_error.h> | |
61 | #include <mach/boolean.h> | |
62 | ||
0d8733c4 | 63 | extern char * mach_error_string_int(mach_error_t, boolean_t *); |
28f540f4 RM |
64 | |
65 | void | |
d145a456 | 66 | mach_error(char *str, mach_error_t err) |
28f540f4 RM |
67 | { |
68 | char * err_str; | |
69 | char buf[1024]; | |
70 | boolean_t diag; | |
71 | ||
72 | err_str=mach_error_string_int(err, &diag); | |
73 | ||
74 | if ( diag ) { | |
75 | sprintf( buf, "%s %s (%x)", mach_error_type(err), err_str, err ); | |
76 | err_str = buf; | |
77 | } | |
78 | ||
79 | fprintf(stderr, "%s %s\n", str, err_str); | |
80 | } |