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