Add 4-byte header to messages so that we can have different message types
[glibc/nacl-glibc.git] / mach / error_compat.c
blob8f7bd87c0f9c8c89a98986b419b674a11bed0ab9
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
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:
29 Revision 2.3 92/04/01 19:38:18 rpd
31 The static do_compat function is renamed to be globally accessible.
34 #include <mach/error.h>
35 #include <mach_error.h>
36 #include <errorlib.h>
39 void
40 __mach_error_map_compat(mach_error_t *org_err)
42 mach_error_t err = *org_err;
45 * map old error numbers to
46 * to new error sys & subsystem
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;
66 *org_err = err;