libc_errno.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2016-11-12 Bernard The first version
  9. */
  10. #ifndef LIBC_ERRNO_H__
  11. #define LIBC_ERRNO_H__
  12. #include <rtconfig.h>
  13. #if defined(RT_USING_NEWLIB) || defined(RT_USING_MUSL) || defined(_WIN32) || defined(__ARMCC_GNUC__)
  14. /* use errno.h file in toolchains */
  15. #include <errno.h>
  16. #define ENOIOCTLCMD (ERROR_BASE_NO + 515) /* No ioctl command */
  17. #endif
  18. #if defined(__CC_ARM)
  19. /*
  20. defined in armcc/errno.h
  21. #define EDOM 1
  22. #define ERANGE 2
  23. #define EILSEQ 4
  24. #define ESIGNUM 3
  25. #define EINVAL 5
  26. #define ENOMEM 6
  27. */
  28. #define ERROR_BASE_NO 7
  29. #elif defined(__IAR_SYSTEMS_ICC__)
  30. /* defined in iar/errno.h
  31. #define EDOM 33
  32. #define ERANGE 34
  33. #define EFPOS 35
  34. #define EILSEQ 36
  35. */
  36. #define ERROR_BASE_NO 36
  37. #else
  38. #define ERROR_BASE_NO 0
  39. #endif
  40. #if !defined(RT_USING_NEWLIB) && !defined(RT_USING_MUSL) && !defined(_WIN32) && !defined(__ARMCC_GNUC__)
  41. #define EPERM (ERROR_BASE_NO + 1)
  42. #define ENOENT (ERROR_BASE_NO + 2)
  43. #define ESRCH (ERROR_BASE_NO + 3)
  44. #define EINTR (ERROR_BASE_NO + 4)
  45. #define EIO (ERROR_BASE_NO + 5)
  46. #define ENXIO (ERROR_BASE_NO + 6)
  47. #define E2BIG (ERROR_BASE_NO + 7)
  48. #define ENOEXEC (ERROR_BASE_NO + 8)
  49. #define EBADF (ERROR_BASE_NO + 9)
  50. #define ECHILD (ERROR_BASE_NO + 10)
  51. #define EAGAIN (ERROR_BASE_NO + 11)
  52. #ifndef ENOMEM
  53. #define ENOMEM (ERROR_BASE_NO + 12)
  54. #endif
  55. #define EACCES (ERROR_BASE_NO + 13)
  56. #define EFAULT (ERROR_BASE_NO + 14)
  57. #define ENOTBLK (ERROR_BASE_NO + 15)
  58. #define EBUSY (ERROR_BASE_NO + 16)
  59. #define EEXIST (ERROR_BASE_NO + 17)
  60. #define EXDEV (ERROR_BASE_NO + 18)
  61. #define ENODEV (ERROR_BASE_NO + 19)
  62. #define ENOTDIR (ERROR_BASE_NO + 20)
  63. #define EISDIR (ERROR_BASE_NO + 21)
  64. #ifndef EINVAL
  65. #define EINVAL (ERROR_BASE_NO + 22)
  66. #endif
  67. #define ENFILE (ERROR_BASE_NO + 23)
  68. #define EMFILE (ERROR_BASE_NO + 24)
  69. #define ENOTTY (ERROR_BASE_NO + 25)
  70. #define ETXTBSY (ERROR_BASE_NO + 26)
  71. #define EFBIG (ERROR_BASE_NO + 27)
  72. #define ENOSPC (ERROR_BASE_NO + 28)
  73. #define ESPIPE (ERROR_BASE_NO + 29)
  74. #define EROFS (ERROR_BASE_NO + 30)
  75. #define EMLINK (ERROR_BASE_NO + 31)
  76. #define EPIPE (ERROR_BASE_NO + 32)
  77. #ifndef EDOM
  78. #define EDOM (ERROR_BASE_NO + 33)
  79. #endif
  80. #ifndef ERANGE
  81. #define ERANGE (ERROR_BASE_NO + 34)
  82. #endif
  83. #define EDEADLK (ERROR_BASE_NO + 35)
  84. #define ENAMETOOLONG (ERROR_BASE_NO + 36)
  85. #define ENOLCK (ERROR_BASE_NO + 37)
  86. #define ENOSYS (ERROR_BASE_NO + 38)
  87. #define ENOTEMPTY (ERROR_BASE_NO + 39)
  88. #define ELOOP (ERROR_BASE_NO + 40)
  89. #define EWOULDBLOCK EAGAIN
  90. #define ENOMSG (ERROR_BASE_NO + 42)
  91. #define EIDRM (ERROR_BASE_NO + 43)
  92. #define ECHRNG (ERROR_BASE_NO + 44)
  93. #define EL2NSYNC (ERROR_BASE_NO + 45)
  94. #define EL3HLT (ERROR_BASE_NO + 46)
  95. #define EL3RST (ERROR_BASE_NO + 47)
  96. #define ELNRNG (ERROR_BASE_NO + 48)
  97. #define EUNATCH (ERROR_BASE_NO + 49)
  98. #define ENOCSI (ERROR_BASE_NO + 50)
  99. #define EL2HLT (ERROR_BASE_NO + 51)
  100. #define EBADE (ERROR_BASE_NO + 52)
  101. #define EBADR (ERROR_BASE_NO + 53)
  102. #define EXFULL (ERROR_BASE_NO + 54)
  103. #define ENOANO (ERROR_BASE_NO + 55)
  104. #define EBADRQC (ERROR_BASE_NO + 56)
  105. #define EBADSLT (ERROR_BASE_NO + 57)
  106. #define EDEADLOCK EDEADLK
  107. #define EBFONT (ERROR_BASE_NO + 59)
  108. #define ENOSTR (ERROR_BASE_NO + 60)
  109. #define ENODATA (ERROR_BASE_NO + 61)
  110. #define ETIME (ERROR_BASE_NO + 62)
  111. #define ENOSR (ERROR_BASE_NO + 63)
  112. #define ENONET (ERROR_BASE_NO + 64)
  113. #define ENOPKG (ERROR_BASE_NO + 65)
  114. #define EREMOTE (ERROR_BASE_NO + 66)
  115. #define ENOLINK (ERROR_BASE_NO + 67)
  116. #define EADV (ERROR_BASE_NO + 68)
  117. #define ESRMNT (ERROR_BASE_NO + 69)
  118. #define ECOMM (ERROR_BASE_NO + 70)
  119. #define EPROTO (ERROR_BASE_NO + 71)
  120. #define EMULTIHOP (ERROR_BASE_NO + 72)
  121. #define EDOTDOT (ERROR_BASE_NO + 73)
  122. #define EBADMSG (ERROR_BASE_NO + 74)
  123. #define EOVERFLOW (ERROR_BASE_NO + 75)
  124. #define ENOTUNIQ (ERROR_BASE_NO + 76)
  125. #define EBADFD (ERROR_BASE_NO + 77)
  126. #define EREMCHG (ERROR_BASE_NO + 78)
  127. #define ELIBACC (ERROR_BASE_NO + 79)
  128. #define ELIBBAD (ERROR_BASE_NO + 80)
  129. #define ELIBSCN (ERROR_BASE_NO + 81)
  130. #define ELIBMAX (ERROR_BASE_NO + 82)
  131. #define ELIBEXEC (ERROR_BASE_NO + 83)
  132. #ifndef EILSEQ
  133. #define EILSEQ (ERROR_BASE_NO + 84)
  134. #endif
  135. #define ERESTART (ERROR_BASE_NO + 85)
  136. #define ESTRPIPE (ERROR_BASE_NO + 86)
  137. #define EUSERS (ERROR_BASE_NO + 87)
  138. #define ENOTSOCK (ERROR_BASE_NO + 88)
  139. #define EDESTADDRREQ (ERROR_BASE_NO + 89)
  140. #define EMSGSIZE (ERROR_BASE_NO + 90)
  141. #define EPROTOTYPE (ERROR_BASE_NO + 91)
  142. #define ENOPROTOOPT (ERROR_BASE_NO + 92)
  143. #define EPROTONOSUPPORT (ERROR_BASE_NO + 93)
  144. #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94)
  145. #define EOPNOTSUPP (ERROR_BASE_NO + 95)
  146. #define ENOTSUP EOPNOTSUPP
  147. #define EPFNOSUPPORT (ERROR_BASE_NO + 96)
  148. #define EAFNOSUPPORT (ERROR_BASE_NO + 97)
  149. #define EADDRINUSE (ERROR_BASE_NO + 98)
  150. #define EADDRNOTAVAIL (ERROR_BASE_NO + 99)
  151. #define ENETDOWN (ERROR_BASE_NO + 100)
  152. #define ENETUNREACH (ERROR_BASE_NO + 101)
  153. #define ENETRESET (ERROR_BASE_NO + 102)
  154. #define ECONNABORTED (ERROR_BASE_NO + 103)
  155. #define ECONNRESET (ERROR_BASE_NO + 104)
  156. #define ENOBUFS (ERROR_BASE_NO + 105)
  157. #define EISCONN (ERROR_BASE_NO + 106)
  158. #define ENOTCONN (ERROR_BASE_NO + 107)
  159. #define ESHUTDOWN (ERROR_BASE_NO + 108)
  160. #define ETOOMANYREFS (ERROR_BASE_NO + 109)
  161. #define ETIMEDOUT (ERROR_BASE_NO + 110)
  162. #define ECONNREFUSED (ERROR_BASE_NO + 111)
  163. #define EHOSTDOWN (ERROR_BASE_NO + 112)
  164. #define EHOSTUNREACH (ERROR_BASE_NO + 113)
  165. #define EALREADY (ERROR_BASE_NO + 114)
  166. #define EINPROGRESS (ERROR_BASE_NO + 115)
  167. #define ESTALE (ERROR_BASE_NO + 116)
  168. #define EUCLEAN (ERROR_BASE_NO + 117)
  169. #define ENOTNAM (ERROR_BASE_NO + 118)
  170. #define ENAVAIL (ERROR_BASE_NO + 119)
  171. #define EISNAM (ERROR_BASE_NO + 120)
  172. #define EREMOTEIO (ERROR_BASE_NO + 121)
  173. #define EDQUOT (ERROR_BASE_NO + 122)
  174. #define ENOMEDIUM (ERROR_BASE_NO + 123)
  175. #define EMEDIUMTYPE (ERROR_BASE_NO + 124)
  176. #define ECANCELED (ERROR_BASE_NO + 125)
  177. #define ENOKEY (ERROR_BASE_NO + 126)
  178. #define EKEYEXPIRED (ERROR_BASE_NO + 127)
  179. #define EKEYREVOKED (ERROR_BASE_NO + 128)
  180. #define EKEYREJECTED (ERROR_BASE_NO + 129)
  181. #define EOWNERDEAD (ERROR_BASE_NO + 130)
  182. #define ENOTRECOVERABLE (ERROR_BASE_NO + 131)
  183. #define ERFKILL (ERROR_BASE_NO + 132)
  184. #define EHWPOISON (ERROR_BASE_NO + 133)
  185. #endif
  186. #endif