error_compat.c 2.0 KB

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