errno.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. /****************************************************************************
  2. * include/errno.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __INCLUDE_ERRNO_H
  21. #define __INCLUDE_ERRNO_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <nuttx/compiler.h>
  26. /****************************************************************************
  27. * Pre-processor Definitions
  28. ****************************************************************************/
  29. /* Convenience/compatibility definition. If the errno is accessed from the
  30. * internal OS code, then the OS code should use the set_errno() and
  31. * get_errno(). Currently, those are just placeholders but would be needed
  32. * in the KERNEL mode build in order to instantiate the process address
  33. * environment as necessary to access the TLS-based errno variable.
  34. */
  35. #define errno *__errno()
  36. #define set_errno(e) \
  37. do \
  38. { \
  39. errno = (int)(e); \
  40. } \
  41. while (0)
  42. #define get_errno() errno
  43. /* Definitions of error numbers and the string that would be
  44. * returned by strerror().
  45. */
  46. #define EPERM 1
  47. #define EPERM_STR "Operation not permitted"
  48. #define ENOENT 2
  49. #define ENOENT_STR "No such file or directory"
  50. #define ESRCH 3
  51. #define ESRCH_STR "No such process"
  52. #define EINTR 4
  53. #define EINTR_STR "Interrupted system call"
  54. #define EIO 5
  55. #define EIO_STR "I/O error"
  56. #define ENXIO 6
  57. #define ENXIO_STR "No such device or address"
  58. #define E2BIG 7
  59. #define E2BIG_STR "Arg list too long"
  60. #define ENOEXEC 8
  61. #define ENOEXEC_STR "Exec format error"
  62. #define EBADF 9
  63. #define EBADF_STR "Bad file number"
  64. #define ECHILD 10
  65. #define ECHILD_STR "No child processes"
  66. #define EAGAIN 11
  67. #define EWOULDBLOCK EAGAIN
  68. #define EAGAIN_STR "Try again"
  69. #define ENOMEM 12
  70. #define ENOMEM_STR "Out of memory"
  71. #define EACCES 13
  72. #define EACCES_STR "Permission denied"
  73. #define EFAULT 14 /* Linux errno extension */
  74. #define EFAULT_STR "Bad address"
  75. #define ENOTBLK 15
  76. #define ENOTBLK_STR "Block device required"
  77. #define EBUSY 16
  78. #define EBUSY_STR "Device or resource busy"
  79. #define EEXIST 17
  80. #define EEXIST_STR "File exists"
  81. #define EXDEV 18
  82. #define EXDEV_STR "Cross-device link"
  83. #define ENODEV 19
  84. #define ENODEV_STR "No such device"
  85. #define ENOTDIR 20
  86. #define ENOTDIR_STR "Not a directory"
  87. #define EISDIR 21
  88. #define EISDIR_STR "Is a directory"
  89. #define EINVAL 22
  90. #define EINVAL_STR "Invalid argument"
  91. #define ENFILE 23
  92. #define ENFILE_STR "File table overflow"
  93. #define EMFILE 24
  94. #define EMFILE_STR "Too many open files"
  95. #define ENOTTY 25
  96. #define ENOTTY_STR "Not a typewriter"
  97. #define ETXTBSY 26
  98. #define ETXTBSY_STR "Text file busy"
  99. #define EFBIG 27
  100. #define EFBIG_STR "File too large"
  101. #define ENOSPC 28
  102. #define ENOSPC_STR "No space left on device"
  103. #define ESPIPE 29
  104. #define ESPIPE_STR "Illegal seek"
  105. #define EROFS 30
  106. #define EROFS_STR "Read-only file system"
  107. #define EMLINK 31
  108. #define EMLINK_STR "Too many links"
  109. #define EPIPE 32
  110. #define EPIPE_STR "Broken pipe"
  111. #define EDOM 33
  112. #define EDOM_STR "Math argument out of domain of func"
  113. #define ERANGE 34
  114. #define ERANGE_STR "Math result not representable"
  115. #define ENOMSG 35
  116. #define ENOMSG_STR "No message of desired type"
  117. #define EIDRM 36
  118. #define EIDRM_STR "Identifier removed"
  119. #define ECHRNG 37 /* Linux errno extension */
  120. #define ECHRNG_STR "Channel number out of range"
  121. #define EL2NSYNC 38 /* Linux errno extension */
  122. #define EL2NSYNC_STR "Level 2 not synchronized"
  123. #define EL3HLT 39 /* Linux errno extension */
  124. #define EL3HLT_STR "Level 3 halted"
  125. #define EL3RST 40 /* Linux errno extension */
  126. #define EL3RST_STR "Level 3 reset"
  127. #define ELNRNG 41 /* Linux errno extension */
  128. #define ELNRNG_STR "Link number out of range"
  129. #define EUNATCH 42 /* Linux errno extension */
  130. #define EUNATCH_STR "Protocol driver not attached"
  131. #define ENOCSI 43 /* Linux errno extension */
  132. #define ENOCSI_STR "No CSI structure available"
  133. #define EL2HLT 44 /* Linux errno extension */
  134. #define EL2HLT_STR "Level 2 halted"
  135. #define EDEADLK 45
  136. #define EDEADLK_STR "Resource deadlock would occur"
  137. #define ENOLCK 46
  138. #define ENOLCK_STR "No record locks available"
  139. #define EBADE 50 /* Linux errno extension */
  140. #define EBADE_STR "Invalid exchange"
  141. #define EBADR 51 /* Linux errno extension */
  142. #define EBADR_STR "Invalid request descriptor"
  143. #define EXFULL 52 /* Linux errno extension */
  144. #define EXFULL_STR "Exchange full"
  145. #define ENOANO 53 /* Linux errno extension */
  146. #define ENOANO_STR "No anode"
  147. #define EBADRQC 54 /* Linux errno extension */
  148. #define EBADRQC_STR "Invalid request code"
  149. #define EBADSLT 55 /* Linux errno extension */
  150. #define EBADSLT_STR "Invalid slot"
  151. #define EDEADLOCK 56 /* Linux errno extension */
  152. #define EDEADLOCK_STR "File locking deadlock error"
  153. #define EBFONT 57 /* Linux errno extension */
  154. #define EBFONT_STR "Bad font file format"
  155. #define ENOSTR 60
  156. #define ENOSTR_STR "Device not a stream"
  157. #define ENODATA 61
  158. #define ENODATA_STR "No data available"
  159. #define ETIME 62
  160. #define ETIME_STR "Timer expired"
  161. #define ENOSR 63
  162. #define ENOSR_STR "Out of streams resources"
  163. #define ENONET 64 /* Linux errno extension */
  164. #define ENONET_STR "Machine is not on the network"
  165. #define ENOPKG 65 /* Linux errno extension */
  166. #define ENOPKG_STR "Package not installed"
  167. #define EREMOTE 66 /* Linux errno extension */
  168. #define EREMOTE_STR "Object is remote"
  169. #define ENOLINK 67
  170. #define ENOLINK_STR "Link has been severed"
  171. #define EADV 68 /* Linux errno extension */
  172. #define EADV_STR "Advertise error"
  173. #define ESRMNT 69 /* Linux errno extension */
  174. #define ESRMNT_STR "Srmount error"
  175. #define ECOMM 70 /* Linux errno extension */
  176. #define ECOMM_STR "Communication error on send"
  177. #define EPROTO 71
  178. #define EPROTO_STR "Protocol error"
  179. #define EMULTIHOP 74
  180. #define EMULTIHOP_STR "Multihop attempted"
  181. #define ELBIN 75 /* Linux errno extension */
  182. #define ELBIN_STR "Inode is remote"
  183. #define EDOTDOT 76 /* Linux errno extension */
  184. #define EDOTDOT_STR "RFS specific error"
  185. #define EBADMSG 77
  186. #define EBADMSG_STR "Not a data message"
  187. #define EFTYPE 79
  188. #define EFTYPE_STR "Inappropriate file type or format"
  189. #define ENOTUNIQ 80 /* Linux errno extension */
  190. #define ENOTUNIQ_STR "Name not unique on network"
  191. #define EBADFD 81 /* Linux errno extension */
  192. #define EBADFD_STR "File descriptor in bad state"
  193. #define EREMCHG 82 /* Linux errno extension */
  194. #define EREMCHG_STR "Remote address changed"
  195. #define ELIBACC 83 /* Linux errno extension */
  196. #define ELIBACC_STR "Can not access a needed shared library"
  197. #define ELIBBAD 84 /* Linux errno extension */
  198. #define ELIBBAD_STR "Accessing a corrupted shared library"
  199. #define ELIBSCN 85 /* Linux errno extension */
  200. #define ELIBSCN_STR ".lib section in a.out corrupted"
  201. #define ELIBMAX 86 /* Linux errno extension */
  202. #define ELIBMAX_STR "Attempting to link in too many shared libraries"
  203. #define ELIBEXEC 87 /* Linux errno extension */
  204. #define ELIBEXEC_STR "Cannot exec a shared library directly"
  205. #define ENOSYS 88
  206. #define ENOSYS_STR "Function not implemented"
  207. #define ENMFILE 89 /* Cygwin */
  208. #define ENMFILE_STR "No more files"
  209. #define ENOTEMPTY 90
  210. #define ENOTEMPTY_STR "Directory not empty"
  211. #define ENAMETOOLONG 91
  212. #define ENAMETOOLONG_STR "File name too long"
  213. #define ELOOP 92
  214. #define ELOOP_STR "Too many symbolic links encountered"
  215. #define EOPNOTSUPP 95
  216. #define EOPNOTSUPP_STR "Operation not supported on transport endpoint"
  217. #define EPFNOSUPPORT 96
  218. #define EPFNOSUPPORT_STR "Protocol family not supported"
  219. #define ECONNRESET 104
  220. #define ECONNRESET_STR "Connection reset by peer"
  221. #define ENOBUFS 105
  222. #define ENOBUFS_STR "No buffer space available"
  223. #define EAFNOSUPPORT 106
  224. #define EAFNOSUPPORT_STR "Address family not supported by protocol"
  225. #define EPROTOTYPE 107
  226. #define EPROTOTYPE_STR "Protocol wrong type for socket"
  227. #define ENOTSOCK 108
  228. #define ENOTSOCK_STR "Socket operation on non-socket"
  229. #define ENOPROTOOPT 109
  230. #define ENOPROTOOPT_STR "Protocol not available"
  231. #define ESHUTDOWN 110 /* Linux errno extension */
  232. #define ESHUTDOWN_STR "Cannot send after transport endpoint shutdown"
  233. #define ECONNREFUSED 111
  234. #define ECONNREFUSED_STR "Connection refused"
  235. #define EADDRINUSE 112
  236. #define EADDRINUSE_STR "Address already in use"
  237. #define ECONNABORTED 113
  238. #define ECONNABORTED_STR "Software caused connection abort"
  239. #define ENETUNREACH 114
  240. #define ENETUNREACH_STR "Network is unreachable"
  241. #define ENETDOWN 115
  242. #define ENETDOWN_STR "Network is down"
  243. #define ETIMEDOUT 116
  244. #define ETIMEDOUT_STR "Connection timed out"
  245. #define EHOSTDOWN 117
  246. #define EHOSTDOWN_STR "Host is down"
  247. #define EHOSTUNREACH 118
  248. #define EHOSTUNREACH_STR "No route to host"
  249. #define EINPROGRESS 119
  250. #define EINPROGRESS_STR "Operation now in progress"
  251. #define EALREADY 120
  252. #define EALREADY_STR "Socket already connected"
  253. #define EDESTADDRREQ 121
  254. #define EDESTADDRREQ_STR "Destination address required"
  255. #define EMSGSIZE 122
  256. #define EMSGSIZE_STR "Message too long"
  257. #define EPROTONOSUPPORT 123
  258. #define EPROTONOSUPPORT_STR "Protocol not supported"
  259. #define ESOCKTNOSUPPORT 124 /* Linux errno extension */
  260. #define ESOCKTNOSUPPORT_STR "Socket type not supported"
  261. #define EADDRNOTAVAIL 125
  262. #define EADDRNOTAVAIL_STR "Cannot assign requested address"
  263. #define ENETRESET 126
  264. #define ENETRESET_STR "Network dropped connection because of reset"
  265. #define EISCONN 127
  266. #define EISCONN_STR "Transport endpoint is already connected"
  267. #define ENOTCONN 128
  268. #define ENOTCONN_STR "Transport endpoint is not connected"
  269. #define ETOOMANYREFS 129
  270. #define ETOOMANYREFS_STR "Too many references: cannot splice"
  271. #define EPROCLIM 130
  272. #define EPROCLIM_STR "Limit would be exceeded by attempted fork"
  273. #define EUSERS 131
  274. #define EUSERS_STR "Too many users"
  275. #define EDQUOT 132
  276. #define EDQUOT_STR "Quota exceeded"
  277. #define ESTALE 133
  278. #define ESTALE_STR "Stale NFS file handle"
  279. #define ENOTSUP 134
  280. #define ENOTSUP_STR "Not supported"
  281. #define ENOMEDIUM 135 /* Linux errno extension */
  282. #define ENOMEDIUM_STR "No medium found"
  283. #define ENOSHARE 136 /* Cygwin */
  284. #define ENOSHARE_STR "No such host or network path"
  285. #define ECASECLASH 137 /* Cygwin */
  286. #define ECASECLASH_STR "Filename exists with different case"
  287. #define EILSEQ 138
  288. #define EILSEQ_STR "Illegal byte sequence"
  289. #define EOVERFLOW 139
  290. #define EOVERFLOW_STR "Value too large for defined data type"
  291. #define ECANCELED 140
  292. #define ECANCELED_STR "Operation cancelled"
  293. #define ENOTRECOVERABLE 141
  294. #define ENOTRECOVERABLE_STR "State not recoverable"
  295. #define EOWNERDEAD 142
  296. #define EOWNERDEAD_STR "Previous owner died"
  297. #define ESTRPIPE 143 /* Linux errno extension */
  298. #define ESTRPIPE_STR "Streams pipe error"
  299. #define __ELASTERROR 2000 /* Users can add values starting here */
  300. /****************************************************************************
  301. * Public Type Definitions
  302. ****************************************************************************/
  303. /****************************************************************************
  304. * Public Function Prototypes
  305. ****************************************************************************/
  306. #undef EXTERN
  307. #if defined(__cplusplus)
  308. #define EXTERN extern "C"
  309. extern "C"
  310. {
  311. #else
  312. #define EXTERN extern
  313. #endif
  314. /* Return a pointer to the thread specific errno. */
  315. FAR int *__errno(void);
  316. #undef EXTERN
  317. #if defined(__cplusplus)
  318. }
  319. #endif
  320. #endif /* __INCLUDE_ERRNO_H */