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