1bb3c896dim// -*- C++ -*-
2bb3c896dim//===-------------------------- errno.h -----------------------------------===//
3bb3c896dim//
410907fcdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
510907fcdim// See https://llvm.org/LICENSE.txt for license information.
610907fcdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7bb3c896dim//
8bb3c896dim//===----------------------------------------------------------------------===//
9bb3c896dim
10bb3c896dim#ifndef _LIBCPP_ERRNO_H
11bb3c896dim#define _LIBCPP_ERRNO_H
12bb3c896dim
13bb3c896dim/*
14bb3c896dim    errno.h synopsis
15bb3c896dim
16bb3c896dimMacros:
17bb3c896dim
18bb3c896dim    EDOM
19bb3c896dim    EILSEQ  // C99
20bb3c896dim    ERANGE
21bb3c896dim    errno
22bb3c896dim
23bb3c896dim*/
24bb3c896dim
25bb3c896dim#include <__config>
26bb3c896dim
27bb3c896dim#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
28bb3c896dim#pragma GCC system_header
29bb3c896dim#endif
30bb3c896dim
31bb3c896dim#include_next <errno.h>
32bb3c896dim
33bb3c896dim#ifdef __cplusplus
34bb3c896dim
3572a21bamckusick#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY)
36bb3c896dim
37115404dmckusick#if defined(ELAST)
38bb3c896dim
39bb3c896dimstatic const int __elast1 = ELAST+1;
40bb3c896dimstatic const int __elast2 = ELAST+2;
417bd3ea2mckusickstatic const int __elast3 = ELAST+3;
42bb3c896dim
43bb3c896dim#else
44bb3c896dim
45bb3c896dimstatic const int __elast1 = 104;
46bb3c896dimstatic const int __elast2 = 105;
477bd3ea2mckusickstatic const int __elast3 = 106;
48bb3c896dim
49bb3c896dim#endif
50bb3c896dim
5172a21bamckusick#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
5272a21bamckusick#define ENOTRECOVERABLE __elast1
5372a21bamckusick#define EOWNERDEAD __elast2
5472a21bamckusick#define EINTEGRITY __elast3
55115404dmckusick#if defined(ELAST)
5672a21bamckusick#undef ELAST
5772a21bamckusick#define ELAST EINTEGRITY
580c6131bmckusick#endif
59bb3c896dim
6072a21bamckusick#elif !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
6172a21bamckusick#define ENOTRECOVERABLE __elast1
6272a21bamckusick#define EOWNERDEAD __elast2
63115404dmckusick#if defined(ELAST)
6472a21bamckusick#undef ELAST
6572a21bamckusick#define ELAST EOWNERDEAD
660c6131bmckusick#endif
6772a21bamckusick
6872a21bamckusick#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
69bb3c896dim#define EOWNERDEAD __elast1
7072a21bamckusick#define EINTEGRITY __elast2
71115404dmckusick#if defined(ELAST)
7272a21bamckusick#undef ELAST
7372a21bamckusick#define ELAST EINTEGRITY
740c6131bmckusick#endif
75bb3c896dim
7672a21bamckusick#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
7772a21bamckusick#define EOWNERDEAD __elast1
78115404dmckusick#if defined(ELAST)
79bb3c896dim#undef ELAST
80bb3c896dim#define ELAST EOWNERDEAD
810c6131bmckusick#endif
82bb3c896dim
8372a21bamckusick#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
8472a21bamckusick#define ENOTRECOVERABLE __elast1
8572a21bamckusick#define EINTEGRITY __elast2
86115404dmckusick#if defined(ELAST)
8772a21bamckusick#undef ELAST
8872a21bamckusick#define ELAST EINTEGRITY
890c6131bmckusick#endif
90bb3c896dim
9172a21bamckusick#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
92bb3c896dim#define ENOTRECOVERABLE __elast1
93115404dmckusick#if defined(ELAST)
94bb3c896dim#undef ELAST
95bb3c896dim#define ELAST ENOTRECOVERABLE
960c6131bmckusick#endif
97bb3c896dim
9872a21bamckusick#elif defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
9972a21bamckusick#define EINTEGRITY __elast1
100115404dmckusick#if defined(ELAST)
101bb3c896dim#undef ELAST
10272a21bamckusick#define ELAST EINTEGRITY
1030c6131bmckusick#endif
104bb3c896dim
10572a21bamckusick#endif // !defined(OWNERDEAD) && !defined(NOTRECOVERABLE) && !defined(INTEGRITY)
106bb3c896dim
10772a21bamckusick#endif // !defined(OWNERDEAD) || !defined(NOTRECOVERABLE) || !defined(INTEGRITY)
108bb3c896dim
109bb3c896dim//  supply errno values likely to be missing, particularly on Windows
110bb3c896dim
111bb3c896dim#ifndef EAFNOSUPPORT
112bb3c896dim#define EAFNOSUPPORT 9901
113bb3c896dim#endif
114bb3c896dim
115bb3c896dim#ifndef EADDRINUSE
116bb3c896dim#define EADDRINUSE 9902
117bb3c896dim#endif
118bb3c896dim
119bb3c896dim#ifndef EADDRNOTAVAIL
120bb3c896dim#define EADDRNOTAVAIL 9903
121bb3c896dim#endif
122bb3c896dim
123bb3c896dim#ifndef EISCONN
124bb3c896dim#define EISCONN 9904
125bb3c896dim#endif
126bb3c896dim
127bb3c896dim#ifndef EBADMSG
128bb3c896dim#define EBADMSG 9905
129bb3c896dim#endif
130bb3c896dim
131bb3c896dim#ifndef ECONNABORTED
132bb3c896dim#define ECONNABORTED 9906
133bb3c896dim#endif
134bb3c896dim
135bb3c896dim#ifndef EALREADY
136bb3c896dim#define EALREADY 9907
137bb3c896dim#endif
138bb3c896dim
139bb3c896dim#ifndef ECONNREFUSED
140bb3c896dim#define ECONNREFUSED 9908
141bb3c896dim#endif
142bb3c896dim
143bb3c896dim#ifndef ECONNRESET
144bb3c896dim#define ECONNRESET 9909
145bb3c896dim#endif
146bb3c896dim
147bb3c896dim#ifndef EDESTADDRREQ
148bb3c896dim#define EDESTADDRREQ 9910
149bb3c896dim#endif
150bb3c896dim
151bb3c896dim#ifndef EHOSTUNREACH
152bb3c896dim#define EHOSTUNREACH 9911
153bb3c896dim#endif
154bb3c896dim
155bb3c896dim#ifndef EIDRM
156bb3c896dim#define EIDRM 9912
157bb3c896dim#endif
158bb3c896dim
159bb3c896dim#ifndef EMSGSIZE
160bb3c896dim#define EMSGSIZE 9913
161bb3c896dim#endif
162bb3c896dim
163bb3c896dim#ifndef ENETDOWN
164bb3c896dim#define ENETDOWN 9914
165bb3c896dim#endif
166bb3c896dim
167bb3c896dim#ifndef ENETRESET
168bb3c896dim#define ENETRESET 9915
169bb3c896dim#endif
170bb3c896dim
171bb3c896dim#ifndef ENETUNREACH
172bb3c896dim#define ENETUNREACH 9916
173bb3c896dim#endif
174bb3c896dim
175bb3c896dim#ifndef ENOBUFS
176bb3c896dim#define ENOBUFS 9917
177bb3c896dim#endif
178bb3c896dim
179bb3c896dim#ifndef ENOLINK
180bb3c896dim#define ENOLINK 9918
181bb3c896dim#endif
182bb3c896dim
183bb3c896dim#ifndef ENODATA
184bb3c896dim#define ENODATA 9919
185bb3c896dim#endif
186bb3c896dim
187bb3c896dim#ifndef ENOMSG
188bb3c896dim#define ENOMSG 9920
189bb3c896dim#endif
190bb3c896dim
191bb3c896dim#ifndef ENOPROTOOPT
192bb3c896dim#define ENOPROTOOPT 9921
193bb3c896dim#endif
194bb3c896dim
195bb3c896dim#ifndef ENOSR
196bb3c896dim#define ENOSR 9922
197bb3c896dim#endif
198bb3c896dim
199bb3c896dim#ifndef ENOTSOCK
200bb3c896dim#define ENOTSOCK 9923
201bb3c896dim#endif
202bb3c896dim
203bb3c896dim#ifndef ENOSTR
204bb3c896dim#define ENOSTR 9924
205bb3c896dim#endif
206bb3c896dim
207bb3c896dim#ifndef ENOTCONN
208bb3c896dim#define ENOTCONN 9925
209bb3c896dim#endif
210bb3c896dim
211bb3c896dim#ifndef ENOTSUP
212bb3c896dim#define ENOTSUP 9926
213bb3c896dim#endif
214bb3c896dim
215bb3c896dim#ifndef ECANCELED
216bb3c896dim#define ECANCELED 9927
217bb3c896dim#endif
218bb3c896dim
219bb3c896dim#ifndef EINPROGRESS
220bb3c896dim#define EINPROGRESS 9928
221bb3c896dim#endif
222bb3c896dim
223bb3c896dim#ifndef EOPNOTSUPP
224bb3c896dim#define EOPNOTSUPP 9929
225bb3c896dim#endif
226bb3c896dim
227bb3c896dim#ifndef EWOULDBLOCK
228bb3c896dim#define EWOULDBLOCK 9930
229bb3c896dim#endif
230bb3c896dim
231bb3c896dim#ifndef EOWNERDEAD
232bb3c896dim#define EOWNERDEAD  9931
233bb3c896dim#endif
234bb3c896dim
235bb3c896dim#ifndef EPROTO
236bb3c896dim#define EPROTO 9932
237bb3c896dim#endif
238bb3c896dim
239bb3c896dim#ifndef EPROTONOSUPPORT
240bb3c896dim#define EPROTONOSUPPORT 9933
241bb3c896dim#endif
242bb3c896dim
243bb3c896dim#ifndef ENOTRECOVERABLE
244bb3c896dim#define ENOTRECOVERABLE 9934
245bb3c896dim#endif
246bb3c896dim
247bb3c896dim#ifndef ETIME
248bb3c896dim#define ETIME 9935
249bb3c896dim#endif
250bb3c896dim
251bb3c896dim#ifndef ETXTBSY
252bb3c896dim#define ETXTBSY 9936
253bb3c896dim#endif
254bb3c896dim
255bb3c896dim#ifndef ETIMEDOUT
256bb3c896dim#define ETIMEDOUT 9938
257bb3c896dim#endif
258bb3c896dim
259bb3c896dim#ifndef ELOOP
260bb3c896dim#define ELOOP 9939
261bb3c896dim#endif
262bb3c896dim
263bb3c896dim#ifndef EOVERFLOW
264bb3c896dim#define EOVERFLOW 9940
265bb3c896dim#endif
266bb3c896dim
267bb3c896dim#ifndef EPROTOTYPE
268bb3c896dim#define EPROTOTYPE 9941
269bb3c896dim#endif
270bb3c896dim
271bb3c896dim#ifndef ENOSYS
272bb3c896dim#define ENOSYS 9942
273bb3c896dim#endif
274bb3c896dim
275bb3c896dim#ifndef EINVAL
276bb3c896dim#define EINVAL 9943
277bb3c896dim#endif
278bb3c896dim
279bb3c896dim#ifndef ERANGE
280bb3c896dim#define ERANGE 9944
281bb3c896dim#endif
282bb3c896dim
283bb3c896dim#ifndef EILSEQ
284bb3c896dim#define EILSEQ 9945
285bb3c896dim#endif
286bb3c896dim
287bb3c896dim//  Windows Mobile doesn't appear to define these:
288bb3c896dim
289bb3c896dim#ifndef E2BIG
290bb3c896dim#define E2BIG 9946
291bb3c896dim#endif
292bb3c896dim
293bb3c896dim#ifndef EDOM
294bb3c896dim#define EDOM 9947
295bb3c896dim#endif
296bb3c896dim
297bb3c896dim#ifndef EFAULT
298bb3c896dim#define EFAULT 9948
299bb3c896dim#endif
300bb3c896dim
301bb3c896dim#ifndef EBADF
302bb3c896dim#define EBADF 9949
303bb3c896dim#endif
304bb3c896dim
305bb3c896dim#ifndef EPIPE
306bb3c896dim#define EPIPE 9950
307bb3c896dim#endif
308bb3c896dim
309bb3c896dim#ifndef EXDEV
310bb3c896dim#define EXDEV 9951
311bb3c896dim#endif
312bb3c896dim
313bb3c896dim#ifndef EBUSY
314bb3c896dim#define EBUSY 9952
315bb3c896dim#endif
316bb3c896dim
317bb3c896dim#ifndef ENOTEMPTY
318bb3c896dim#define ENOTEMPTY 9953
319bb3c896dim#endif
320bb3c896dim
321bb3c896dim#ifndef ENOEXEC
322bb3c896dim#define ENOEXEC 9954
323bb3c896dim#endif
324bb3c896dim
325bb3c896dim#ifndef EEXIST
326bb3c896dim#define EEXIST 9955
327bb3c896dim#endif
328bb3c896dim
329bb3c896dim#ifndef EFBIG
330bb3c896dim#define EFBIG 9956
331bb3c896dim#endif
332bb3c896dim
333bb3c896dim#ifndef ENAMETOOLONG
334bb3c896dim#define ENAMETOOLONG 9957
335bb3c896dim#endif
336bb3c896dim
337bb3c896dim#ifndef ENOTTY
338bb3c896dim#define ENOTTY 9958
339bb3c896dim#endif
340bb3c896dim
341bb3c896dim#ifndef EINTR
342bb3c896dim#define EINTR 9959
343bb3c896dim#endif
344bb3c896dim
345bb3c896dim#ifndef ESPIPE
346bb3c896dim#define ESPIPE 9960
347bb3c896dim#endif
348bb3c896dim
349bb3c896dim#ifndef EIO
350bb3c896dim#define EIO 9961
351bb3c896dim#endif
352bb3c896dim
353bb3c896dim#ifndef EISDIR
354bb3c896dim#define EISDIR 9962
355bb3c896dim#endif
356bb3c896dim
357bb3c896dim#ifndef ECHILD
358bb3c896dim#define ECHILD 9963
359bb3c896dim#endif
360bb3c896dim
361bb3c896dim#ifndef ENOLCK
362bb3c896dim#define ENOLCK 9964
363bb3c896dim#endif
364bb3c896dim
365bb3c896dim#ifndef ENOSPC
366bb3c896dim#define ENOSPC 9965
367bb3c896dim#endif
368bb3c896dim
369bb3c896dim#ifndef ENXIO
370bb3c896dim#define ENXIO 9966
371bb3c896dim#endif
372bb3c896dim
373bb3c896dim#ifndef ENODEV
374bb3c896dim#define ENODEV 9967
375bb3c896dim#endif
376bb3c896dim
377bb3c896dim#ifndef ENOENT
378bb3c896dim#define ENOENT 9968
379bb3c896dim#endif
380bb3c896dim
381bb3c896dim#ifndef ESRCH
382bb3c896dim#define ESRCH 9969
383bb3c896dim#endif
384bb3c896dim
385bb3c896dim#ifndef ENOTDIR
386bb3c896dim#define ENOTDIR 9970
387bb3c896dim#endif
388bb3c896dim
389bb3c896dim#ifndef ENOMEM
390bb3c896dim#define ENOMEM 9971
391bb3c896dim#endif
392bb3c896dim
393bb3c896dim#ifndef EPERM
394bb3c896dim#define EPERM 9972
395bb3c896dim#endif
396bb3c896dim
397bb3c896dim#ifndef EACCES
398bb3c896dim#define EACCES 9973
399bb3c896dim#endif
400bb3c896dim
401bb3c896dim#ifndef EROFS
402bb3c896dim#define EROFS 9974
403bb3c896dim#endif
404bb3c896dim
405bb3c896dim#ifndef EDEADLK
406bb3c896dim#define EDEADLK 9975
407bb3c896dim#endif
408bb3c896dim
409bb3c896dim#ifndef EAGAIN
410bb3c896dim#define EAGAIN 9976
411bb3c896dim#endif
412bb3c896dim
413bb3c896dim#ifndef ENFILE
414bb3c896dim#define ENFILE 9977
415bb3c896dim#endif
416bb3c896dim
417bb3c896dim#ifndef EMFILE
418bb3c896dim#define EMFILE 9978
419bb3c896dim#endif
420bb3c896dim
421bb3c896dim#ifndef EMLINK
422bb3c896dim#define EMLINK 9979
423bb3c896dim#endif
424bb3c896dim
42572a21bamckusick#ifndef EINTEGRITY
42672a21bamckusick#define EINTEGRITY 9980
42772a21bamckusick#endif
42872a21bamckusick
429bb3c896dim#endif // __cplusplus
430bb3c896dim
431bb3c896dim#endif  // _LIBCPP_ERRNO_H
432