errno.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-05-22 Meco Man The first version.
  9. */
  10. #ifndef __SYS_ERRNO_H__
  11. #define __SYS_ERRNO_H__
  12. #if defined(__ARMCC_VERSION)
  13. /*
  14. defined in armcc/errno.h
  15. #define EDOM 1
  16. #define ERANGE 2
  17. #define EILSEQ 4
  18. #define ESIGNUM 3
  19. #define EINVAL 5
  20. #define ENOMEM 6
  21. */
  22. #define ERROR_BASE_NO 7
  23. #elif defined(__IAR_SYSTEMS_ICC__)
  24. /* defined in iar/errno.h
  25. #define EDOM 33
  26. #define ERANGE 34
  27. #define EFPOS 35
  28. #define EILSEQ 36
  29. */
  30. #define ERROR_BASE_NO 36
  31. #else
  32. #define ERROR_BASE_NO 0
  33. #endif
  34. #if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__)
  35. #include <errno.h>
  36. #ifndef EPERM
  37. #define EPERM (ERROR_BASE_NO + 1)
  38. #endif
  39. #ifndef ENOENT
  40. #define ENOENT (ERROR_BASE_NO + 2)
  41. #endif
  42. #ifndef ESRCH
  43. #define ESRCH (ERROR_BASE_NO + 3)
  44. #endif
  45. #ifndef EINTR
  46. #define EINTR (ERROR_BASE_NO + 4)
  47. #endif
  48. #ifndef EIO
  49. #define EIO (ERROR_BASE_NO + 5)
  50. #endif
  51. #ifndef ENXIO
  52. #define ENXIO (ERROR_BASE_NO + 6)
  53. #endif
  54. #ifndef E2BIG
  55. #define E2BIG (ERROR_BASE_NO + 7)
  56. #endif
  57. #ifndef ENOEXEC
  58. #define ENOEXEC (ERROR_BASE_NO + 8)
  59. #endif
  60. #ifndef EBADF
  61. #define EBADF (ERROR_BASE_NO + 9)
  62. #endif
  63. #ifndef ECHILD
  64. #define ECHILD (ERROR_BASE_NO + 10)
  65. #endif
  66. #ifndef EAGAIN
  67. #define EAGAIN (ERROR_BASE_NO + 11)
  68. #endif
  69. #ifndef ENOMEM
  70. #define ENOMEM (ERROR_BASE_NO + 12)
  71. #endif
  72. #ifndef EACCES
  73. #define EACCES (ERROR_BASE_NO + 13)
  74. #endif
  75. #ifndef EFAULT
  76. #define EFAULT (ERROR_BASE_NO + 14)
  77. #endif
  78. #ifndef ENOTBLK
  79. #define ENOTBLK (ERROR_BASE_NO + 15)
  80. #endif
  81. #ifndef EBUSY
  82. #define EBUSY (ERROR_BASE_NO + 16)
  83. #endif
  84. #ifndef EEXIST
  85. #define EEXIST (ERROR_BASE_NO + 17)
  86. #endif
  87. #ifndef EXDEV
  88. #define EXDEV (ERROR_BASE_NO + 18)
  89. #endif
  90. #ifndef ENODEV
  91. #define ENODEV (ERROR_BASE_NO + 19)
  92. #endif
  93. #ifndef ENOTDIR
  94. #define ENOTDIR (ERROR_BASE_NO + 20)
  95. #endif
  96. #ifndef EISDIR
  97. #define EISDIR (ERROR_BASE_NO + 21)
  98. #endif
  99. #ifndef EINVAL
  100. #define EINVAL (ERROR_BASE_NO + 22)
  101. #endif
  102. #ifndef ENFILE
  103. #define ENFILE (ERROR_BASE_NO + 23)
  104. #endif
  105. #ifndef EMFILE
  106. #define EMFILE (ERROR_BASE_NO + 24)
  107. #endif
  108. #ifndef ENOTTY
  109. #define ENOTTY (ERROR_BASE_NO + 25)
  110. #endif
  111. #ifndef ETXTBSY
  112. #define ETXTBSY (ERROR_BASE_NO + 26)
  113. #endif
  114. #ifndef EFBIG
  115. #define EFBIG (ERROR_BASE_NO + 27)
  116. #endif
  117. #ifndef ENOSPC
  118. #define ENOSPC (ERROR_BASE_NO + 28)
  119. #endif
  120. #ifndef ESPIPE
  121. #define ESPIPE (ERROR_BASE_NO + 29)
  122. #endif
  123. #ifndef EROFS
  124. #define EROFS (ERROR_BASE_NO + 30)
  125. #endif
  126. #ifndef EMLINK
  127. #define EMLINK (ERROR_BASE_NO + 31)
  128. #endif
  129. #ifndef EPIPE
  130. #define EPIPE (ERROR_BASE_NO + 32)
  131. #endif
  132. #ifndef EDOM
  133. #define EDOM (ERROR_BASE_NO + 33)
  134. #endif
  135. #ifndef ERANGE
  136. #define ERANGE (ERROR_BASE_NO + 34)
  137. #endif
  138. #ifndef EDEADLK
  139. #define EDEADLK (ERROR_BASE_NO + 35)
  140. #endif
  141. #ifndef ENAMETOOLONG
  142. #define ENAMETOOLONG (ERROR_BASE_NO + 36)
  143. #endif
  144. #ifndef ENOLCK
  145. #define ENOLCK (ERROR_BASE_NO + 37)
  146. #endif
  147. #ifndef ENOSYS
  148. #define ENOSYS (ERROR_BASE_NO + 38)
  149. #endif
  150. #ifndef ENOTEMPTY
  151. #define ENOTEMPTY (ERROR_BASE_NO + 39)
  152. #endif
  153. #ifndef ELOOP
  154. #define ELOOP (ERROR_BASE_NO + 40)
  155. #endif
  156. #ifndef EWOULDBLOCK
  157. #define EWOULDBLOCK EAGAIN
  158. #endif
  159. #ifndef ENOMSG
  160. #define ENOMSG (ERROR_BASE_NO + 42)
  161. #endif
  162. #ifndef EIDRM
  163. #define EIDRM (ERROR_BASE_NO + 43)
  164. #endif
  165. #ifndef ECHRNG
  166. #define ECHRNG (ERROR_BASE_NO + 44)
  167. #endif
  168. #ifndef EL2NSYNC
  169. #define EL2NSYNC (ERROR_BASE_NO + 45)
  170. #endif
  171. #ifndef EL3HLT
  172. #define EL3HLT (ERROR_BASE_NO + 46)
  173. #endif
  174. #ifndef EL3RST
  175. #define EL3RST (ERROR_BASE_NO + 47)
  176. #endif
  177. #ifndef ELNRNG
  178. #define ELNRNG (ERROR_BASE_NO + 48)
  179. #endif
  180. #ifndef EUNATCH
  181. #define EUNATCH (ERROR_BASE_NO + 49)
  182. #endif
  183. #ifndef ENOCSI
  184. #define ENOCSI (ERROR_BASE_NO + 50)
  185. #endif
  186. #ifndef EL2HLT
  187. #define EL2HLT (ERROR_BASE_NO + 51)
  188. #endif
  189. #ifndef EBADE
  190. #define EBADE (ERROR_BASE_NO + 52)
  191. #endif
  192. #ifndef EBADR
  193. #define EBADR (ERROR_BASE_NO + 53)
  194. #endif
  195. #ifndef EXFULL
  196. #define EXFULL (ERROR_BASE_NO + 54)
  197. #endif
  198. #ifndef ENOANO
  199. #define ENOANO (ERROR_BASE_NO + 55)
  200. #endif
  201. #ifndef EBADRQC
  202. #define EBADRQC (ERROR_BASE_NO + 56)
  203. #endif
  204. #ifndef EBADSLT
  205. #define EBADSLT (ERROR_BASE_NO + 57)
  206. #endif
  207. #ifndef EDEADLOCK
  208. #define EDEADLOCK EDEADLK
  209. #endif
  210. #ifndef EBFONT
  211. #define EBFONT (ERROR_BASE_NO + 59)
  212. #endif
  213. #ifndef ENOSTR
  214. #define ENOSTR (ERROR_BASE_NO + 60)
  215. #endif
  216. #ifndef ENODATA
  217. #define ENODATA (ERROR_BASE_NO + 61)
  218. #endif
  219. #ifndef ETIME
  220. #define ETIME (ERROR_BASE_NO + 62)
  221. #endif
  222. #ifndef ENOSR
  223. #define ENOSR (ERROR_BASE_NO + 63)
  224. #endif
  225. #ifndef ENONET
  226. #define ENONET (ERROR_BASE_NO + 64)
  227. #endif
  228. #ifndef ENOPKG
  229. #define ENOPKG (ERROR_BASE_NO + 65)
  230. #endif
  231. #ifndef EREMOTE
  232. #define EREMOTE (ERROR_BASE_NO + 66)
  233. #endif
  234. #ifndef ENOLINK
  235. #define ENOLINK (ERROR_BASE_NO + 67)
  236. #endif
  237. #ifndef EADV
  238. #define EADV (ERROR_BASE_NO + 68)
  239. #endif
  240. #ifndef ESRMNT
  241. #define ESRMNT (ERROR_BASE_NO + 69)
  242. #endif
  243. #ifndef ECOMM
  244. #define ECOMM (ERROR_BASE_NO + 70)
  245. #endif
  246. #ifndef EPROTO
  247. #define EPROTO (ERROR_BASE_NO + 71)
  248. #endif
  249. #ifndef EMULTIHOP
  250. #define EMULTIHOP (ERROR_BASE_NO + 72)
  251. #endif
  252. #ifndef EDOTDOT
  253. #define EDOTDOT (ERROR_BASE_NO + 73)
  254. #endif
  255. #ifndef EBADMSG
  256. #define EBADMSG (ERROR_BASE_NO + 74)
  257. #endif
  258. #ifndef EOVERFLOW
  259. #define EOVERFLOW (ERROR_BASE_NO + 75)
  260. #endif
  261. #ifndef ENOTUNIQ
  262. #define ENOTUNIQ (ERROR_BASE_NO + 76)
  263. #endif
  264. #ifndef EBADFD
  265. #define EBADFD (ERROR_BASE_NO + 77)
  266. #endif
  267. #ifndef EREMCHG
  268. #define EREMCHG (ERROR_BASE_NO + 78)
  269. #endif
  270. #ifndef ELIBACC
  271. #define ELIBACC (ERROR_BASE_NO + 79)
  272. #endif
  273. #ifndef ELIBBAD
  274. #define ELIBBAD (ERROR_BASE_NO + 80)
  275. #endif
  276. #ifndef ELIBSCN
  277. #define ELIBSCN (ERROR_BASE_NO + 81)
  278. #endif
  279. #ifndef ELIBMAX
  280. #define ELIBMAX (ERROR_BASE_NO + 82)
  281. #endif
  282. #ifndef ELIBEXEC
  283. #define ELIBEXEC (ERROR_BASE_NO + 83)
  284. #endif
  285. #ifndef EILSEQ
  286. #define EILSEQ (ERROR_BASE_NO + 84)
  287. #endif
  288. #ifndef ERESTART
  289. #define ERESTART (ERROR_BASE_NO + 85)
  290. #endif
  291. #ifndef ESTRPIPE
  292. #define ESTRPIPE (ERROR_BASE_NO + 86)
  293. #endif
  294. #ifndef EUSERS
  295. #define EUSERS (ERROR_BASE_NO + 87)
  296. #endif
  297. #ifndef ENOTSOCK
  298. #define ENOTSOCK (ERROR_BASE_NO + 88)
  299. #endif
  300. #ifndef EDESTADDRREQ
  301. #define EDESTADDRREQ (ERROR_BASE_NO + 89)
  302. #endif
  303. #ifndef EMSGSIZE
  304. #define EMSGSIZE (ERROR_BASE_NO + 90)
  305. #endif
  306. #ifndef EPROTOTYPE
  307. #define EPROTOTYPE (ERROR_BASE_NO + 91)
  308. #endif
  309. #ifndef ENOPROTOOPT
  310. #define ENOPROTOOPT (ERROR_BASE_NO + 92)
  311. #endif
  312. #ifndef EPROTONOSUPPORT
  313. #define EPROTONOSUPPORT (ERROR_BASE_NO + 93)
  314. #endif
  315. #ifndef ESOCKTNOSUPPORT
  316. #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94)
  317. #endif
  318. #ifndef EOPNOTSUPP
  319. #define EOPNOTSUPP (ERROR_BASE_NO + 95)
  320. #endif
  321. #ifndef ENOTSUP
  322. #define ENOTSUP EOPNOTSUPP
  323. #endif
  324. #ifndef EPFNOSUPPORT
  325. #define EPFNOSUPPORT (ERROR_BASE_NO + 96)
  326. #endif
  327. #ifndef EAFNOSUPPORT
  328. #define EAFNOSUPPORT (ERROR_BASE_NO + 97)
  329. #endif
  330. #ifndef EADDRINUSE
  331. #define EADDRINUSE (ERROR_BASE_NO + 98)
  332. #endif
  333. #ifndef EADDRNOTAVAIL
  334. #define EADDRNOTAVAIL (ERROR_BASE_NO + 99)
  335. #endif
  336. #ifndef ENETDOWN
  337. #define ENETDOWN (ERROR_BASE_NO + 100)
  338. #endif
  339. #ifndef ENETUNREACH
  340. #define ENETUNREACH (ERROR_BASE_NO + 101)
  341. #endif
  342. #ifndef ENETRESET
  343. #define ENETRESET (ERROR_BASE_NO + 102)
  344. #endif
  345. #ifndef ECONNABORTED
  346. #define ECONNABORTED (ERROR_BASE_NO + 103)
  347. #endif
  348. #ifndef ECONNRESET
  349. #define ECONNRESET (ERROR_BASE_NO + 104)
  350. #endif
  351. #ifndef ENOBUFS
  352. #define ENOBUFS (ERROR_BASE_NO + 105)
  353. #endif
  354. #ifndef EISCONN
  355. #define EISCONN (ERROR_BASE_NO + 106)
  356. #endif
  357. #ifndef ENOTCONN
  358. #define ENOTCONN (ERROR_BASE_NO + 107)
  359. #endif
  360. #ifndef ESHUTDOWN
  361. #define ESHUTDOWN (ERROR_BASE_NO + 108)
  362. #endif
  363. #ifndef ETOOMANYREFS
  364. #define ETOOMANYREFS (ERROR_BASE_NO + 109)
  365. #endif
  366. #ifndef ETIMEDOUT
  367. #define ETIMEDOUT (ERROR_BASE_NO + 110)
  368. #endif
  369. #ifndef ECONNREFUSED
  370. #define ECONNREFUSED (ERROR_BASE_NO + 111)
  371. #endif
  372. #ifndef EHOSTDOWN
  373. #define EHOSTDOWN (ERROR_BASE_NO + 112)
  374. #endif
  375. #ifndef EHOSTUNREACH
  376. #define EHOSTUNREACH (ERROR_BASE_NO + 113)
  377. #endif
  378. #ifndef EALREADY
  379. #define EALREADY (ERROR_BASE_NO + 114)
  380. #endif
  381. #ifndef EINPROGRESS
  382. #define EINPROGRESS (ERROR_BASE_NO + 115)
  383. #endif
  384. #ifndef ESTALE
  385. #define ESTALE (ERROR_BASE_NO + 116)
  386. #endif
  387. #ifndef EUCLEAN
  388. #define EUCLEAN (ERROR_BASE_NO + 117)
  389. #endif
  390. #ifndef ENOTNAM
  391. #define ENOTNAM (ERROR_BASE_NO + 118)
  392. #endif
  393. #ifndef ENAVAIL
  394. #define ENAVAIL (ERROR_BASE_NO + 119)
  395. #endif
  396. #ifndef EISNAM
  397. #define EISNAM (ERROR_BASE_NO + 120)
  398. #endif
  399. #ifndef EREMOTEIO
  400. #define EREMOTEIO (ERROR_BASE_NO + 121)
  401. #endif
  402. #ifndef EDQUOT
  403. #define EDQUOT (ERROR_BASE_NO + 122)
  404. #endif
  405. #ifndef ENOMEDIUM
  406. #define ENOMEDIUM (ERROR_BASE_NO + 123)
  407. #endif
  408. #ifndef EMEDIUMTYPE
  409. #define EMEDIUMTYPE (ERROR_BASE_NO + 124)
  410. #endif
  411. #ifndef ECANCELED
  412. #define ECANCELED (ERROR_BASE_NO + 125)
  413. #endif
  414. #ifndef ENOKEY
  415. #define ENOKEY (ERROR_BASE_NO + 126)
  416. #endif
  417. #ifndef EKEYEXPIRED
  418. #define EKEYEXPIRED (ERROR_BASE_NO + 127)
  419. #endif
  420. #ifndef EKEYREVOKED
  421. #define EKEYREVOKED (ERROR_BASE_NO + 128)
  422. #endif
  423. #ifndef EKEYREJECTED
  424. #define EKEYREJECTED (ERROR_BASE_NO + 129)
  425. #endif
  426. #ifndef EOWNERDEAD
  427. #define EOWNERDEAD (ERROR_BASE_NO + 130)
  428. #endif
  429. #ifndef ENOTRECOVERABLE
  430. #define ENOTRECOVERABLE (ERROR_BASE_NO + 131)
  431. #endif
  432. #ifndef ERFKILL
  433. #define ERFKILL (ERROR_BASE_NO + 132)
  434. #endif
  435. #ifndef EHWPOISON
  436. #define EHWPOISON (ERROR_BASE_NO + 133)
  437. #endif
  438. #elif defined(_WIN32)
  439. #include <errno.h>
  440. #endif /* defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) */
  441. #endif /* __SYS_ERRNO_H__ */