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