Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. status.c
  5. Abstract:
  6. This module attempts to map NT status codes to Unix error
  7. numbers as specified by the X/Open Transport Interface.
  8. Author:
  9. Eric Chin (ericc) August 2, 1991
  10. Revision History:
  11. --*/
  12. #include "common.h"
  13. #include <sock_err.h>
  14. int
  15. MapNtToPosixStatus(
  16. IN NTSTATUS status
  17. )
  18. /*++
  19. Routine Description:
  20. This function returns a POSIX error number, given an NT status code.
  21. Arguments:
  22. status - an NT status code
  23. Return Value:
  24. the corresponding POSIX error number
  25. --*/
  26. {
  27. switch (status) {
  28. case STATUS_INSUFFICIENT_RESOURCES:
  29. return(ENOSR);
  30. case STATUS_INVALID_PARAMETER:
  31. return(EINVAL);
  32. case STATUS_NO_SUCH_DEVICE:
  33. return(ENXIO);
  34. case STATUS_INVALID_NETWORK_RESPONSE:
  35. return(ENETDOWN);
  36. case STATUS_NETWORK_BUSY:
  37. return(EBUSY);
  38. case STATUS_ACCESS_DENIED:
  39. return(EACCES);
  40. default:
  41. return(EINVAL);
  42. }
  43. }