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