2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_ERRNO_H
11 #define _LIBCPP_ERRNO_H
27 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
28 # pragma GCC system_header
31 #if __has_include_next(<errno.h>)
32 # include_next <errno.h>
37 # if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
41 static const int __elast1
= ELAST
+ 1;
42 static const int __elast2
= ELAST
+ 2;
46 static const int __elast1
= 104;
47 static const int __elast2
= 105;
51 # ifdef ENOTRECOVERABLE
53 # define EOWNERDEAD __elast1
57 # define ELAST EOWNERDEAD
60 # elif defined(EOWNERDEAD)
62 # define ENOTRECOVERABLE __elast1
65 # define ELAST ENOTRECOVERABLE
68 # else // defined(EOWNERDEAD)
70 # define EOWNERDEAD __elast1
71 # define ENOTRECOVERABLE __elast2
74 # define ELAST ENOTRECOVERABLE
77 # endif // defined(EOWNERDEAD)
79 # endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
81 // supply errno values likely to be missing, particularly on Windows
84 # define EAFNOSUPPORT 9901
88 # define EADDRINUSE 9902
91 # ifndef EADDRNOTAVAIL
92 # define EADDRNOTAVAIL 9903
100 # define EBADMSG 9905
103 # ifndef ECONNABORTED
104 # define ECONNABORTED 9906
108 # define EALREADY 9907
111 # ifndef ECONNREFUSED
112 # define ECONNREFUSED 9908
116 # define ECONNRESET 9909
119 # ifndef EDESTADDRREQ
120 # define EDESTADDRREQ 9910
123 # ifndef EHOSTUNREACH
124 # define EHOSTUNREACH 9911
132 # define EMSGSIZE 9913
136 # define ENETDOWN 9914
140 # define ENETRESET 9915
144 # define ENETUNREACH 9916
148 # define ENOBUFS 9917
152 # define ENOLINK 9918
156 # define ENODATA 9919
164 # define ENOPROTOOPT 9921
172 # define ENOTSOCK 9923
180 # define ENOTCONN 9925
184 # define ENOTSUP 9926
188 # define ECANCELED 9927
192 # define EINPROGRESS 9928
196 # define EOPNOTSUPP 9929
200 # define EWOULDBLOCK 9930
204 # define EOWNERDEAD 9931
211 # ifndef EPROTONOSUPPORT
212 # define EPROTONOSUPPORT 9933
215 # ifndef ENOTRECOVERABLE
216 # define ENOTRECOVERABLE 9934
224 # define ETXTBSY 9936
228 # define ETIMEDOUT 9938
236 # define EOVERFLOW 9940
240 # define EPROTOTYPE 9941
259 // Windows Mobile doesn't appear to define these:
290 # define ENOTEMPTY 9953
294 # define ENOEXEC 9954
305 # ifndef ENAMETOOLONG
306 # define ENAMETOOLONG 9957
358 # define ENOTDIR 9970
378 # define EDEADLK 9975
397 #endif // __cplusplus
399 #endif // _LIBCPP_ERRNO_H