Back to index

glibc  2.9
error_compat.c
Go to the documentation of this file.
00001 /*
00002  * Mach Operating System
00003  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
00004  * All Rights Reserved.
00005  *
00006  * Permission to use, copy, modify and distribute this software and its
00007  * documentation is hereby granted, provided that both the copyright
00008  * notice and this permission notice appear in all copies of the
00009  * software, derivative works or modified versions, and any portions
00010  * thereof, and that both notices appear in supporting documentation.
00011  *
00012  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
00013  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
00014  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00015  *
00016  * Carnegie Mellon requests users of this software to return to
00017  *
00018  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
00019  *  School of Computer Science
00020  *  Carnegie Mellon University
00021  *  Pittsburgh PA 15213-3890
00022  *
00023  * any improvements or extensions that they make and grant Carnegie Mellon
00024  * the rights to redistribute these changes.
00025  */
00026 
00027 /* This file was broken out from:
00028 
00029        Revision 2.3  92/04/01  19:38:18  rpd
00030 
00031    The static do_compat function is renamed to be globally accessible.
00032  */
00033 
00034 #include <mach/error.h>
00035 #include <mach_error.h>
00036 #include <errorlib.h>
00037 
00038 
00039 void
00040 __mach_error_map_compat(mach_error_t  *org_err)
00041 {
00042        mach_error_t         err = *org_err;
00043 
00044        /*
00045         * map old error numbers to
00046         * to new error sys & subsystem
00047         */
00048 
00049        if ((-200 < err) && (err <= -100))
00050               err = -(err + 100) | IPC_SEND_MOD;
00051        else if ((-300 < err) && (err <= -200))
00052               err = -(err + 200) | IPC_RCV_MOD;
00053        else if ((-400 < err) && (err <= -300))
00054               err = -(err + 300) | MACH_IPC_MIG_MOD;
00055        else if ((1000 <= err) && (err < 1100))
00056               err = (err - 1000) | SERV_NETNAME_MOD;
00057        else if ((1600 <= err) && (err < 1700))
00058               err = (err - 1600) | SERV_ENV_MOD;
00059        else if ((27600 <= err) && (err < 27700))
00060               err = (err - 27600) | SERV_EXECD_MOD;
00061        else if ((2500 <= err) && (err < 2600))
00062               err = (err - 2500) | KERN_DEVICE_MOD;
00063        else if ((5000 <= err) && (err < 5100))
00064               err = (err - 5000) | BOOTSTRAP_FS_MOD;
00065 
00066        *org_err = err;
00067 }