Update.
[platform/upstream/glibc.git] / mach / error_compat.c
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 /* This file was broken out from:
28         $Log$
29         Revision 1.2  1997/03/16 17:41:36  drepper
30         (__mach_error_map_compat): Give full prototype.
31
32         Revision 1.2  1997/03/14 15:26:28  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
48         Revision 1.1  1993/11/30 17:35:24  roland
49         entered into RCS
50
51         Revision 2.3  92/04/01  19:38:18  rpd
52    The static do_compat function is renamed to be globally accessible.
53  */
54
55 #include <mach/error.h>
56 #include <mach_error.h>
57 #include <errorlib.h>
58
59
60 void
61 __mach_error_map_compat(mach_error_t  *org_err)
62 {
63         mach_error_t            err = *org_err;
64
65         /* 
66          * map old error numbers to 
67          * to new error sys & subsystem 
68          */
69
70         if ((-200 < err) && (err <= -100))
71                 err = -(err + 100) | IPC_SEND_MOD;
72         else if ((-300 < err) && (err <= -200))
73                 err = -(err + 200) | IPC_RCV_MOD;
74         else if ((-400 < err) && (err <= -300))
75                 err = -(err + 300) | MACH_IPC_MIG_MOD;
76         else if ((1000 <= err) && (err < 1100))
77                 err = (err - 1000) | SERV_NETNAME_MOD;
78         else if ((1600 <= err) && (err < 1700))
79                 err = (err - 1600) | SERV_ENV_MOD;
80         else if ((27600 <= err) && (err < 27700))
81                 err = (err - 27600) | SERV_EXECD_MOD;
82         else if ((2500 <= err) && (err < 2600))
83                 err = (err - 2500) | KERN_DEVICE_MOD;
84         else if ((5000 <= err) && (err < 5100))
85                 err = (err - 5000) | BOOTSTRAP_FS_MOD;
86
87         *org_err = err;
88 }