initial import
[glibc.git] / mach / error_compat.c
blob0498f017bad9162d867d136cfe15402f7b087976
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 /* This file was broken out from:
28 $Log$
29 Revision 1.1 1993/11/30 17:35:24 roland
30 entered into RCS
32 Revision 2.3 92/04/01 19:38:18 rpd
33 The static do_compat function is renamed to be globally accessible.
36 #include <mach/error.h>
37 #include <mach_error.h>
38 #include <errorlib.h>
41 void
42 __mach_error_map_compat( org_err )
43 mach_error_t * org_err;
45 mach_error_t err = *org_err;
47 /*
48 * map old error numbers to
49 * to new error sys & subsystem
52 if ((-200 < err) && (err <= -100))
53 err = -(err + 100) | IPC_SEND_MOD;
54 else if ((-300 < err) && (err <= -200))
55 err = -(err + 200) | IPC_RCV_MOD;
56 else if ((-400 < err) && (err <= -300))
57 err = -(err + 300) | MACH_IPC_MIG_MOD;
58 else if ((1000 <= err) && (err < 1100))
59 err = (err - 1000) | SERV_NETNAME_MOD;
60 else if ((1600 <= err) && (err < 1700))
61 err = (err - 1600) | SERV_ENV_MOD;
62 else if ((27600 <= err) && (err < 27700))
63 err = (err - 27600) | SERV_EXECD_MOD;
64 else if ((2500 <= err) && (err < 2600))
65 err = (err - 2500) | KERN_DEVICE_MOD;
66 else if ((5000 <= err) && (err < 5100))
67 err = (err - 5000) | BOOTSTRAP_FS_MOD;
69 *org_err = err;