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