2005-07-12 Jakub Jelinek <jakub@redhat.com>
[glibc/history.git] / mach / errstring.c
blobe56fa728cc29b8fa78a145a7814216b185b1aa66
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.
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.
27 * HISTORY
28 * $Log$
29 * Revision 1.2 1997/03/16 17:41:48 drepper
30 * (mach_error_string_int): Give full prototype.
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>
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.
39 * * mach/spin-solid.c: Include <mach/mach_traps.h>.
40 * * mach/spin-solid.c (__spin_lock_solid): Provide arg to
41 * swtch_pri.
43 * * mach/mach_init.c: Include <mach/mig_support.h>.
45 * * mach/mach_error.h (mach_error_string, mach_error,
46 * mach_error_type): Always provide prototypes.
48 * Revision 1.1 1993/11/30 17:35:58 roland
49 * entered into RCS
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]
56 * Revision 2.2 92/02/20 15:58:08 elf
57 * Created from mach_error.c.
58 * [92/02/11 rpd]
62 #define EXPORT_BOOLEAN
63 #include <mach/boolean.h>
64 #include <mach/error.h>
65 #include <mach_error.h>
66 #include <errorlib.h>
68 extern void __mach_error_map_compat (mach_error_t *);
70 const char *
71 mach_error_type( err )
72 mach_error_t err;
74 int sub, system;
76 __mach_error_map_compat( &err );
78 sub = err_get_sub(err);
79 system = err_get_system(err);
81 if (system > err_max_system
82 || sub >= errors[system].max_sub ) return( "(?/?)" );
83 return( errors[system].subsystem[sub].subsys_name );
86 boolean_t mach_error_full_diag = FALSE;
88 const char *
89 mach_error_string_int(mach_error_t err,
90 boolean_t * diag)
92 int sub, system, code;
94 __mach_error_map_compat( &err );
96 sub = err_get_sub(err);
97 system = err_get_system(err);
98 code = err_get_code(err);
100 *diag = TRUE;
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 );
106 *diag = mach_error_full_diag;
107 return( errors[system].subsystem[sub].codes[code] );
110 const char *
111 mach_error_string( err )
112 mach_error_t err;
114 boolean_t diag;
116 return mach_error_string_int( err, &diag );