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 
29 	Revision 2.3  92/04/01  19:38:18  rpd
30 
31    The static do_compat function is renamed to be globally accessible.
32  */
33 
34 #include <mach/error.h>
35 #include <mach_error.h>
36 #include <errorlib.h>
37 
38 
39 void
__mach_error_map_compat(mach_error_t * org_err)40 __mach_error_map_compat(mach_error_t  *org_err)
41 {
42 	mach_error_t		err = *org_err;
43 
44 	/*
45 	 * map old error numbers to
46 	 * to new error sys & subsystem
47 	 */
48 
49 	if ((-200 < err) && (err <= -100))
50 		err = -(err + 100) | IPC_SEND_MOD;
51 	else if ((-300 < err) && (err <= -200))
52 		err = -(err + 200) | IPC_RCV_MOD;
53 	else if ((-400 < err) && (err <= -300))
54 		err = -(err + 300) | MACH_IPC_MIG_MOD;
55 	else if ((1000 <= err) && (err < 1100))
56 		err = (err - 1000) | SERV_NETNAME_MOD;
57 	else if ((1600 <= err) && (err < 1700))
58 		err = (err - 1600) | SERV_ENV_MOD;
59 	else if ((27600 <= err) && (err < 27700))
60 		err = (err - 27600) | SERV_EXECD_MOD;
61 	else if ((2500 <= err) && (err < 2600))
62 		err = (err - 2500) | KERN_DEVICE_MOD;
63 	else if ((5000 <= err) && (err < 5100))
64 		err = (err - 5000) | BOOTSTRAP_FS_MOD;
65 
66 	*org_err = err;
67 }
68