errno.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_ERRNO_H
  10. #define _LIBCPP_ERRNO_H
  11. /*
  12. errno.h synopsis
  13. Macros:
  14. EDOM
  15. EILSEQ // C99
  16. ERANGE
  17. errno
  18. */
  19. #include <__config>
  20. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  21. # pragma GCC system_header
  22. #endif
  23. #ifdef _LIBCPP_COMPILER_MSVC
  24. // errno is defined in several files so we can't use #ifndef errno here
  25. #ifdef errno
  26. // undefine errno to avoid substitution in errno.h include file name.
  27. #pragma push_macro("errno")
  28. #undef errno
  29. #include Y_UCRT_INCLUDE_NEXT(errno.h)
  30. #pragma pop_macro("errno")
  31. #else
  32. #include Y_UCRT_INCLUDE_NEXT(errno.h)
  33. #endif
  34. #else
  35. #include_next <errno.h>
  36. #endif
  37. #ifdef __cplusplus
  38. #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
  39. #ifdef ELAST
  40. static const int __elast1 = ELAST+1;
  41. static const int __elast2 = ELAST+2;
  42. #else
  43. static const int __elast1 = 104;
  44. static const int __elast2 = 105;
  45. #endif
  46. #ifdef ENOTRECOVERABLE
  47. #define EOWNERDEAD __elast1
  48. #ifdef ELAST
  49. #undef ELAST
  50. #define ELAST EOWNERDEAD
  51. #endif
  52. #elif defined(EOWNERDEAD)
  53. #define ENOTRECOVERABLE __elast1
  54. #ifdef ELAST
  55. #undef ELAST
  56. #define ELAST ENOTRECOVERABLE
  57. #endif
  58. #else // defined(EOWNERDEAD)
  59. #define EOWNERDEAD __elast1
  60. #define ENOTRECOVERABLE __elast2
  61. #ifdef ELAST
  62. #undef ELAST
  63. #define ELAST ENOTRECOVERABLE
  64. #endif
  65. #endif // defined(EOWNERDEAD)
  66. #endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
  67. // supply errno values likely to be missing, particularly on Windows
  68. #ifndef EAFNOSUPPORT
  69. #define EAFNOSUPPORT 9901
  70. #endif
  71. #ifndef EADDRINUSE
  72. #define EADDRINUSE 9902
  73. #endif
  74. #ifndef EADDRNOTAVAIL
  75. #define EADDRNOTAVAIL 9903
  76. #endif
  77. #ifndef EISCONN
  78. #define EISCONN 9904
  79. #endif
  80. #ifndef EBADMSG
  81. #define EBADMSG 9905
  82. #endif
  83. #ifndef ECONNABORTED
  84. #define ECONNABORTED 9906
  85. #endif
  86. #ifndef EALREADY
  87. #define EALREADY 9907
  88. #endif
  89. #ifndef ECONNREFUSED
  90. #define ECONNREFUSED 9908
  91. #endif
  92. #ifndef ECONNRESET
  93. #define ECONNRESET 9909
  94. #endif
  95. #ifndef EDESTADDRREQ
  96. #define EDESTADDRREQ 9910
  97. #endif
  98. #ifndef EHOSTUNREACH
  99. #define EHOSTUNREACH 9911
  100. #endif
  101. #ifndef EIDRM
  102. #define EIDRM 9912
  103. #endif
  104. #ifndef EMSGSIZE
  105. #define EMSGSIZE 9913
  106. #endif
  107. #ifndef ENETDOWN
  108. #define ENETDOWN 9914
  109. #endif
  110. #ifndef ENETRESET
  111. #define ENETRESET 9915
  112. #endif
  113. #ifndef ENETUNREACH
  114. #define ENETUNREACH 9916
  115. #endif
  116. #ifndef ENOBUFS
  117. #define ENOBUFS 9917
  118. #endif
  119. #ifndef ENOLINK
  120. #define ENOLINK 9918
  121. #endif
  122. #ifndef ENODATA
  123. #define ENODATA 9919
  124. #endif
  125. #ifndef ENOMSG
  126. #define ENOMSG 9920
  127. #endif
  128. #ifndef ENOPROTOOPT
  129. #define ENOPROTOOPT 9921
  130. #endif
  131. #ifndef ENOSR
  132. #define ENOSR 9922
  133. #endif
  134. #ifndef ENOTSOCK
  135. #define ENOTSOCK 9923
  136. #endif
  137. #ifndef ENOSTR
  138. #define ENOSTR 9924
  139. #endif
  140. #ifndef ENOTCONN
  141. #define ENOTCONN 9925
  142. #endif
  143. #ifndef ENOTSUP
  144. #define ENOTSUP 9926
  145. #endif
  146. #ifndef ECANCELED
  147. #define ECANCELED 9927
  148. #endif
  149. #ifndef EINPROGRESS
  150. #define EINPROGRESS 9928
  151. #endif
  152. #ifndef EOPNOTSUPP
  153. #define EOPNOTSUPP 9929
  154. #endif
  155. #ifndef EWOULDBLOCK
  156. #define EWOULDBLOCK 9930
  157. #endif
  158. #ifndef EOWNERDEAD
  159. #define EOWNERDEAD 9931
  160. #endif
  161. #ifndef EPROTO
  162. #define EPROTO 9932
  163. #endif
  164. #ifndef EPROTONOSUPPORT
  165. #define EPROTONOSUPPORT 9933
  166. #endif
  167. #ifndef ENOTRECOVERABLE
  168. #define ENOTRECOVERABLE 9934
  169. #endif
  170. #ifndef ETIME
  171. #define ETIME 9935
  172. #endif
  173. #ifndef ETXTBSY
  174. #define ETXTBSY 9936
  175. #endif
  176. #ifndef ETIMEDOUT
  177. #define ETIMEDOUT 9938
  178. #endif
  179. #ifndef ELOOP
  180. #define ELOOP 9939
  181. #endif
  182. #ifndef EOVERFLOW
  183. #define EOVERFLOW 9940
  184. #endif
  185. #ifndef EPROTOTYPE
  186. #define EPROTOTYPE 9941
  187. #endif
  188. #ifndef ENOSYS
  189. #define ENOSYS 9942
  190. #endif
  191. #ifndef EINVAL
  192. #define EINVAL 9943
  193. #endif
  194. #ifndef ERANGE
  195. #define ERANGE 9944
  196. #endif
  197. #ifndef EILSEQ
  198. #define EILSEQ 9945
  199. #endif
  200. // Windows Mobile doesn't appear to define these:
  201. #ifndef E2BIG
  202. #define E2BIG 9946
  203. #endif
  204. #ifndef EDOM
  205. #define EDOM 9947
  206. #endif
  207. #ifndef EFAULT
  208. #define EFAULT 9948
  209. #endif
  210. #ifndef EBADF
  211. #define EBADF 9949
  212. #endif
  213. #ifndef EPIPE
  214. #define EPIPE 9950
  215. #endif
  216. #ifndef EXDEV
  217. #define EXDEV 9951
  218. #endif
  219. #ifndef EBUSY
  220. #define EBUSY 9952
  221. #endif
  222. #ifndef ENOTEMPTY
  223. #define ENOTEMPTY 9953
  224. #endif
  225. #ifndef ENOEXEC
  226. #define ENOEXEC 9954
  227. #endif
  228. #ifndef EEXIST
  229. #define EEXIST 9955
  230. #endif
  231. #ifndef EFBIG
  232. #define EFBIG 9956
  233. #endif
  234. #ifndef ENAMETOOLONG
  235. #define ENAMETOOLONG 9957
  236. #endif
  237. #ifndef ENOTTY
  238. #define ENOTTY 9958
  239. #endif
  240. #ifndef EINTR
  241. #define EINTR 9959
  242. #endif
  243. #ifndef ESPIPE
  244. #define ESPIPE 9960
  245. #endif
  246. #ifndef EIO
  247. #define EIO 9961
  248. #endif
  249. #ifndef EISDIR
  250. #define EISDIR 9962
  251. #endif
  252. #ifndef ECHILD
  253. #define ECHILD 9963
  254. #endif
  255. #ifndef ENOLCK
  256. #define ENOLCK 9964
  257. #endif
  258. #ifndef ENOSPC
  259. #define ENOSPC 9965
  260. #endif
  261. #ifndef ENXIO
  262. #define ENXIO 9966
  263. #endif
  264. #ifndef ENODEV
  265. #define ENODEV 9967
  266. #endif
  267. #ifndef ENOENT
  268. #define ENOENT 9968
  269. #endif
  270. #ifndef ESRCH
  271. #define ESRCH 9969
  272. #endif
  273. #ifndef ENOTDIR
  274. #define ENOTDIR 9970
  275. #endif
  276. #ifndef ENOMEM
  277. #define ENOMEM 9971
  278. #endif
  279. #ifndef EPERM
  280. #define EPERM 9972
  281. #endif
  282. #ifndef EACCES
  283. #define EACCES 9973
  284. #endif
  285. #ifndef EROFS
  286. #define EROFS 9974
  287. #endif
  288. #ifndef EDEADLK
  289. #define EDEADLK 9975
  290. #endif
  291. #ifndef EAGAIN
  292. #define EAGAIN 9976
  293. #endif
  294. #ifndef ENFILE
  295. #define ENFILE 9977
  296. #endif
  297. #ifndef EMFILE
  298. #define EMFILE 9978
  299. #endif
  300. #ifndef EMLINK
  301. #define EMLINK 9979
  302. #endif
  303. #endif // __cplusplus
  304. #endif // _LIBCPP_ERRNO_H