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