errno.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Amazon FreeRTOS POSIX V1.1.0
  3. * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. * this software and associated documentation files (the "Software"), to deal in
  7. * the Software without restriction, including without limitation the rights to
  8. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9. * the Software, and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * http://aws.amazon.com/freertos
  23. * http://www.FreeRTOS.org
  24. */
  25. /**
  26. * @file errno.h
  27. * @brief System error numbers.
  28. *
  29. * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
  30. *
  31. * The values defined in this file may not be compatible with the strerror
  32. * function provided by this system.
  33. */
  34. #ifndef _FREERTOS_POSIX_ERRNO_H_
  35. #define _FREERTOS_POSIX_ERRNO_H_
  36. /* Undefine all errnos to avoid redefinition errors with system errnos. */
  37. #undef EPERM
  38. #undef ENOENT
  39. #undef EBADF
  40. #undef EAGAIN
  41. #undef ENOMEM
  42. #undef EEXIST
  43. #undef EBUSY
  44. #undef EINVAL
  45. #undef ENOSPC
  46. #undef ERANGE
  47. #undef ENAMETOOLONG
  48. #undef EDEADLK
  49. #undef EOVERFLOW
  50. #undef ENOSYS
  51. #undef EMSGSIZE
  52. #undef ENOTSUP
  53. #undef ETIMEDOUT
  54. /**
  55. * @name Definition of POSIX errnos.
  56. */
  57. /**@{ */
  58. #define ENOERR 0 /**< No error */
  59. #define EPERM 1 /**< Operation not permitted. */
  60. #define ENOENT 2 /**< No such file or directory. */
  61. #define ESRCH 3 /* No such process */
  62. #define EIO 5 /* I/O error */
  63. #define ENXIO 6 /* No such device or address */
  64. #define EBADF 9 /**< Bad file descriptor. */
  65. #define EAGAIN 11 /**< Resource unavailable, try again. */
  66. #define ENOMEM 12 /**< Not enough space. */
  67. #define EACCES 13 /* Permission denied */
  68. #define EBUSY 16 /**< Device or resource busy. */
  69. #define EEXIST 17 /**< File exists. */
  70. #define ENODEV 19 /* No such device */
  71. #define EINVAL 22 /**< Invalid argument. */
  72. #define ENOSPC 28 /**< No space left on device. */
  73. #define EDOM 33 /**< Mathematics argument out of domain of function. */
  74. #define ERANGE 34 /**< Result too large. */
  75. #define ENAMETOOLONG 36 /**< File name too long. */
  76. #define EDEADLK 45 /**< Resource deadlock would occur. */
  77. #define EPROTO 71 /* Protocol error */
  78. #define EOVERFLOW 75 /**< Value too large to be stored in data type. */
  79. #define EILSEQ 84 /* Illegal byte sequence */
  80. #define ENOSYS 88 /**< Function not supported. */
  81. #define EMSGSIZE 90 /**< Message too long. */
  82. #define ENOTSUP 95 /**< Operation not supported. */
  83. #define EINPROGRESS 115 /* Operation now in progress */
  84. #define ETIMEDOUT 116 /**< Connection timed out. */
  85. #define EREMOTEIO 121 /* Remote I/O error */
  86. #define ENOMEDIUM 123 /* No medium found */
  87. /**@} */
  88. /**
  89. * @name System Variable
  90. *
  91. * @brief Define FreeRTOS+POSIX errno, if enabled.
  92. * Set configUSE_POSIX_ERRNO to enable, and clear to disable. See FreeRTOS.h.
  93. *
  94. * @{
  95. */
  96. #if ( configUSE_POSIX_ERRNO == 1 )
  97. extern int FreeRTOS_errno;
  98. #define errno FreeRTOS_errno
  99. #endif
  100. /**@} */
  101. #endif /* ifndef _FREERTOS_POSIX_ERRNO_H_ */