]> git.ipfire.org Git - thirdparty/glibc.git/blame - mach/errstring.c
malloc: set NON_MAIN_ARENA flag for reclaimed memalign chunk (BZ #30101)
[thirdparty/glibc.git] / mach / errstring.c
CommitLineData
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.3 92/04/01 19:38:18 rpd
30 * Updated do_compat for kernel device errors,
31 * bootstrap file-system errors.
32 * [92/03/09 rpd]
eff75b8d 33 *
28f540f4
RM
34 * Revision 2.2 92/02/20 15:58:08 elf
35 * Created from mach_error.c.
36 * [92/02/11 rpd]
eff75b8d 37 *
28f540f4
RM
38 */
39
40#define EXPORT_BOOLEAN
41#include <mach/boolean.h>
42#include <mach/error.h>
43#include <mach_error.h>
44#include <errorlib.h>
45
46extern void __mach_error_map_compat (mach_error_t *);
47
48const char *
e299076f 49mach_error_type(mach_error_t err)
28f540f4
RM
50{
51 int sub, system;
52
53 __mach_error_map_compat( &err );
54
55 sub = err_get_sub(err);
56 system = err_get_system(err);
57
58 if (system > err_max_system
59 || sub >= errors[system].max_sub ) return( "(?/?)" );
60 return( errors[system].subsystem[sub].subsys_name );
61}
7a8f45e3 62libc_hidden_def (mach_error_type)
28f540f4
RM
63
64boolean_t mach_error_full_diag = FALSE;
65
66const char *
0d8733c4
UD
67mach_error_string_int(mach_error_t err,
68 boolean_t * diag)
28f540f4
RM
69{
70 int sub, system, code;
71
72 __mach_error_map_compat( &err );
73
74 sub = err_get_sub(err);
75 system = err_get_system(err);
76 code = err_get_code(err);
77
78 *diag = TRUE;
79
80 if (system > err_max_system) return( "(?/?) unknown error system" );
81 if (sub >= errors[system].max_sub) return( errors[system].bad_sub );
82 if (code >= errors[system].subsystem[sub].max_code) return ( NO_SUCH_ERROR );
83
84 *diag = mach_error_full_diag;
85 return( errors[system].subsystem[sub].codes[code] );
86}
87
88const char *
e299076f 89mach_error_string(mach_error_t err)
28f540f4
RM
90{
91 boolean_t diag;
92
93 return mach_error_string_int( err, &diag );
94
95}