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