| 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 | |
| 10 | #ifndef _LIBCPP_ERRNO_H |
| 11 | #define _LIBCPP_ERRNO_H |
| 12 | |
| 13 | /* |
| 14 | errno.h synopsis |
| 15 | |
| 16 | Macros: |
| 17 | |
| 18 | EDOM |
| 19 | EILSEQ // C99 |
| 20 | ERANGE |
| 21 | errno |
| 22 | |
| 23 | */ |
| 24 | |
| 25 | #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 26 | # include <__cxx03/errno.h> |
| 27 | #else |
| 28 | # include <__config> |
| 29 | |
| 30 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 31 | # pragma GCC system_header |
| 32 | # endif |
| 33 | |
| 34 | # if __has_include_next(<errno.h>) |
| 35 | # include_next <errno.h> |
| 36 | # endif |
| 37 | |
| 38 | # ifdef __cplusplus |
| 39 | |
| 40 | # if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) |
| 41 | |
| 42 | # ifdef ELAST |
| 43 | |
| 44 | static const int __elast1 = ELAST + 1; |
| 45 | static const int __elast2 = ELAST + 2; |
| 46 | |
| 47 | # else |
| 48 | |
| 49 | static const int __elast1 = 104; |
| 50 | static const int __elast2 = 105; |
| 51 | |
| 52 | # endif |
| 53 | |
| 54 | # ifdef ENOTRECOVERABLE |
| 55 | |
| 56 | # define EOWNERDEAD __elast1 |
| 57 | |
| 58 | # ifdef ELAST |
| 59 | # undef ELAST |
| 60 | # define ELAST EOWNERDEAD |
| 61 | # endif |
| 62 | |
| 63 | # elif defined(EOWNERDEAD) |
| 64 | |
| 65 | # define ENOTRECOVERABLE __elast1 |
| 66 | # ifdef ELAST |
| 67 | # undef ELAST |
| 68 | # define ELAST ENOTRECOVERABLE |
| 69 | # endif |
| 70 | |
| 71 | # else // defined(EOWNERDEAD) |
| 72 | |
| 73 | # define EOWNERDEAD __elast1 |
| 74 | # define ENOTRECOVERABLE __elast2 |
| 75 | # ifdef ELAST |
| 76 | # undef ELAST |
| 77 | # define ELAST ENOTRECOVERABLE |
| 78 | # endif |
| 79 | |
| 80 | # endif // defined(EOWNERDEAD) |
| 81 | |
| 82 | # endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) |
| 83 | |
| 84 | // supply errno values likely to be missing, particularly on Windows |
| 85 | |
| 86 | # ifndef EAFNOSUPPORT |
| 87 | # define EAFNOSUPPORT 9901 |
| 88 | # endif |
| 89 | |
| 90 | # ifndef EADDRINUSE |
| 91 | # define EADDRINUSE 9902 |
| 92 | # endif |
| 93 | |
| 94 | # ifndef EADDRNOTAVAIL |
| 95 | # define EADDRNOTAVAIL 9903 |
| 96 | # endif |
| 97 | |
| 98 | # ifndef EISCONN |
| 99 | # define EISCONN 9904 |
| 100 | # endif |
| 101 | |
| 102 | # ifndef EBADMSG |
| 103 | # define EBADMSG 9905 |
| 104 | # endif |
| 105 | |
| 106 | # ifndef ECONNABORTED |
| 107 | # define ECONNABORTED 9906 |
| 108 | # endif |
| 109 | |
| 110 | # ifndef EALREADY |
| 111 | # define EALREADY 9907 |
| 112 | # endif |
| 113 | |
| 114 | # ifndef ECONNREFUSED |
| 115 | # define ECONNREFUSED 9908 |
| 116 | # endif |
| 117 | |
| 118 | # ifndef ECONNRESET |
| 119 | # define ECONNRESET 9909 |
| 120 | # endif |
| 121 | |
| 122 | # ifndef EDESTADDRREQ |
| 123 | # define EDESTADDRREQ 9910 |
| 124 | # endif |
| 125 | |
| 126 | # ifndef EHOSTUNREACH |
| 127 | # define EHOSTUNREACH 9911 |
| 128 | # endif |
| 129 | |
| 130 | # ifndef EIDRM |
| 131 | # define EIDRM 9912 |
| 132 | # endif |
| 133 | |
| 134 | # ifndef EMSGSIZE |
| 135 | # define EMSGSIZE 9913 |
| 136 | # endif |
| 137 | |
| 138 | # ifndef ENETDOWN |
| 139 | # define ENETDOWN 9914 |
| 140 | # endif |
| 141 | |
| 142 | # ifndef ENETRESET |
| 143 | # define ENETRESET 9915 |
| 144 | # endif |
| 145 | |
| 146 | # ifndef ENETUNREACH |
| 147 | # define ENETUNREACH 9916 |
| 148 | # endif |
| 149 | |
| 150 | # ifndef ENOBUFS |
| 151 | # define ENOBUFS 9917 |
| 152 | # endif |
| 153 | |
| 154 | # ifndef ENOLINK |
| 155 | # define ENOLINK 9918 |
| 156 | # endif |
| 157 | |
| 158 | # ifndef ENODATA |
| 159 | # define ENODATA 9919 |
| 160 | # endif |
| 161 | |
| 162 | # ifndef ENOMSG |
| 163 | # define ENOMSG 9920 |
| 164 | # endif |
| 165 | |
| 166 | # ifndef ENOPROTOOPT |
| 167 | # define ENOPROTOOPT 9921 |
| 168 | # endif |
| 169 | |
| 170 | # ifndef ENOSR |
| 171 | # define ENOSR 9922 |
| 172 | # endif |
| 173 | |
| 174 | # ifndef ENOTSOCK |
| 175 | # define ENOTSOCK 9923 |
| 176 | # endif |
| 177 | |
| 178 | # ifndef ENOSTR |
| 179 | # define ENOSTR 9924 |
| 180 | # endif |
| 181 | |
| 182 | # ifndef ENOTCONN |
| 183 | # define ENOTCONN 9925 |
| 184 | # endif |
| 185 | |
| 186 | # ifndef ENOTSUP |
| 187 | # define ENOTSUP 9926 |
| 188 | # endif |
| 189 | |
| 190 | # ifndef ECANCELED |
| 191 | # define ECANCELED 9927 |
| 192 | # endif |
| 193 | |
| 194 | # ifndef EINPROGRESS |
| 195 | # define EINPROGRESS 9928 |
| 196 | # endif |
| 197 | |
| 198 | # ifndef EOPNOTSUPP |
| 199 | # define EOPNOTSUPP 9929 |
| 200 | # endif |
| 201 | |
| 202 | # ifndef EWOULDBLOCK |
| 203 | # define EWOULDBLOCK 9930 |
| 204 | # endif |
| 205 | |
| 206 | # ifndef EOWNERDEAD |
| 207 | # define EOWNERDEAD 9931 |
| 208 | # endif |
| 209 | |
| 210 | # ifndef EPROTO |
| 211 | # define EPROTO 9932 |
| 212 | # endif |
| 213 | |
| 214 | # ifndef EPROTONOSUPPORT |
| 215 | # define EPROTONOSUPPORT 9933 |
| 216 | # endif |
| 217 | |
| 218 | # ifndef ENOTRECOVERABLE |
| 219 | # define ENOTRECOVERABLE 9934 |
| 220 | # endif |
| 221 | |
| 222 | # ifndef ETIME |
| 223 | # define ETIME 9935 |
| 224 | # endif |
| 225 | |
| 226 | # ifndef ETXTBSY |
| 227 | # define ETXTBSY 9936 |
| 228 | # endif |
| 229 | |
| 230 | # ifndef ETIMEDOUT |
| 231 | # define ETIMEDOUT 9938 |
| 232 | # endif |
| 233 | |
| 234 | # ifndef ELOOP |
| 235 | # define ELOOP 9939 |
| 236 | # endif |
| 237 | |
| 238 | # ifndef EOVERFLOW |
| 239 | # define EOVERFLOW 9940 |
| 240 | # endif |
| 241 | |
| 242 | # ifndef EPROTOTYPE |
| 243 | # define EPROTOTYPE 9941 |
| 244 | # endif |
| 245 | |
| 246 | # ifndef ENOSYS |
| 247 | # define ENOSYS 9942 |
| 248 | # endif |
| 249 | |
| 250 | # ifndef EINVAL |
| 251 | # define EINVAL 9943 |
| 252 | # endif |
| 253 | |
| 254 | # ifndef ERANGE |
| 255 | # define ERANGE 9944 |
| 256 | # endif |
| 257 | |
| 258 | # ifndef EILSEQ |
| 259 | # define EILSEQ 9945 |
| 260 | # endif |
| 261 | |
| 262 | // Windows Mobile doesn't appear to define these: |
| 263 | |
| 264 | # ifndef E2BIG |
| 265 | # define E2BIG 9946 |
| 266 | # endif |
| 267 | |
| 268 | # ifndef EDOM |
| 269 | # define EDOM 9947 |
| 270 | # endif |
| 271 | |
| 272 | # ifndef EFAULT |
| 273 | # define EFAULT 9948 |
| 274 | # endif |
| 275 | |
| 276 | # ifndef EBADF |
| 277 | # define EBADF 9949 |
| 278 | # endif |
| 279 | |
| 280 | # ifndef EPIPE |
| 281 | # define EPIPE 9950 |
| 282 | # endif |
| 283 | |
| 284 | # ifndef EXDEV |
| 285 | # define EXDEV 9951 |
| 286 | # endif |
| 287 | |
| 288 | # ifndef EBUSY |
| 289 | # define EBUSY 9952 |
| 290 | # endif |
| 291 | |
| 292 | # ifndef ENOTEMPTY |
| 293 | # define ENOTEMPTY 9953 |
| 294 | # endif |
| 295 | |
| 296 | # ifndef ENOEXEC |
| 297 | # define ENOEXEC 9954 |
| 298 | # endif |
| 299 | |
| 300 | # ifndef EEXIST |
| 301 | # define EEXIST 9955 |
| 302 | # endif |
| 303 | |
| 304 | # ifndef EFBIG |
| 305 | # define EFBIG 9956 |
| 306 | # endif |
| 307 | |
| 308 | # ifndef ENAMETOOLONG |
| 309 | # define ENAMETOOLONG 9957 |
| 310 | # endif |
| 311 | |
| 312 | # ifndef ENOTTY |
| 313 | # define ENOTTY 9958 |
| 314 | # endif |
| 315 | |
| 316 | # ifndef EINTR |
| 317 | # define EINTR 9959 |
| 318 | # endif |
| 319 | |
| 320 | # ifndef ESPIPE |
| 321 | # define ESPIPE 9960 |
| 322 | # endif |
| 323 | |
| 324 | # ifndef EIO |
| 325 | # define EIO 9961 |
| 326 | # endif |
| 327 | |
| 328 | # ifndef EISDIR |
| 329 | # define EISDIR 9962 |
| 330 | # endif |
| 331 | |
| 332 | # ifndef ECHILD |
| 333 | # define ECHILD 9963 |
| 334 | # endif |
| 335 | |
| 336 | # ifndef ENOLCK |
| 337 | # define ENOLCK 9964 |
| 338 | # endif |
| 339 | |
| 340 | # ifndef ENOSPC |
| 341 | # define ENOSPC 9965 |
| 342 | # endif |
| 343 | |
| 344 | # ifndef ENXIO |
| 345 | # define ENXIO 9966 |
| 346 | # endif |
| 347 | |
| 348 | # ifndef ENODEV |
| 349 | # define ENODEV 9967 |
| 350 | # endif |
| 351 | |
| 352 | # ifndef ENOENT |
| 353 | # define ENOENT 9968 |
| 354 | # endif |
| 355 | |
| 356 | # ifndef ESRCH |
| 357 | # define ESRCH 9969 |
| 358 | # endif |
| 359 | |
| 360 | # ifndef ENOTDIR |
| 361 | # define ENOTDIR 9970 |
| 362 | # endif |
| 363 | |
| 364 | # ifndef ENOMEM |
| 365 | # define ENOMEM 9971 |
| 366 | # endif |
| 367 | |
| 368 | # ifndef EPERM |
| 369 | # define EPERM 9972 |
| 370 | # endif |
| 371 | |
| 372 | # ifndef EACCES |
| 373 | # define EACCES 9973 |
| 374 | # endif |
| 375 | |
| 376 | # ifndef EROFS |
| 377 | # define EROFS 9974 |
| 378 | # endif |
| 379 | |
| 380 | # ifndef EDEADLK |
| 381 | # define EDEADLK 9975 |
| 382 | # endif |
| 383 | |
| 384 | # ifndef EAGAIN |
| 385 | # define EAGAIN 9976 |
| 386 | # endif |
| 387 | |
| 388 | # ifndef ENFILE |
| 389 | # define ENFILE 9977 |
| 390 | # endif |
| 391 | |
| 392 | # ifndef EMFILE |
| 393 | # define EMFILE 9978 |
| 394 | # endif |
| 395 | |
| 396 | # ifndef EMLINK |
| 397 | # define EMLINK 9979 |
| 398 | # endif |
| 399 | |
| 400 | # endif // __cplusplus |
| 401 | #endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 402 | |
| 403 | #endif // _LIBCPP_ERRNO_H |
| 404 | |