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