3 //=============================================================================
9 * @author Don Hinton <dhinton@dresystems.com>
10 * @author This code was originally in various places including ace/OS.h.
12 //=============================================================================
14 #ifndef ACE_OS_INCLUDE_OS_ERRNO_H
15 #define ACE_OS_INCLUDE_OS_ERRNO_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/config-lite.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include /**/ <errno.h>
27 #if defined (ACE_VXWORKS)
28 // Needed for VxWorks to pickup errnoSet()
29 #include /**/ <errnoLib.h>
30 #endif /* ACE_VXWORKS */
32 #ifndef ACE_CUSTOM_ERRNO_BASE
33 # define ACE_CUSTOM_ERRNO_BASE 1000
36 // Place all additions (especially function declarations) within extern "C" {}
40 #endif /* __cplusplus */
42 #if defined (ACE_WIN32)
43 // error code mapping for windows
45 // VC++ 10 has these error codes defined in errno.h,
46 // this will cause different errors in ACE.
47 // So we undef these error codes if they are wrongly defined
48 # if defined (EWOULDBLOCK) && (EWOULDBLOCK != WSAEWOULDBLOCK)
50 # endif /* EWOULDBLOCK */
51 # if defined (EINPROGRESS) && (EINPROGRESS != WSAEINPROGRESS)
53 # endif /* EINPROGRESS */
54 # if defined (EALREADY) && (EALREADY != WSAEALREADY)
56 # endif /* EALREADY */
57 # if defined (ENOTSOCK) && (ENOTSOCK != WSAENOTSOCK)
59 # endif /* ENOTSOCK */
60 # if defined (EDESTADDRREQ) && (EDESTADDRREQ != WSAEDESTADDRREQ)
62 # endif /* EDESTADDRREQ */
63 # if defined (EMSGSIZE) && (EMSGSIZE != WSAEMSGSIZE)
65 # endif /* EMSGSIZE */
66 # if defined (EPROTOTYPE) && (EPROTOTYPE != WSAEPROTOTYPE)
68 # endif /* EPROTOTYPE */
69 # if defined (ENOPROTOOPT) && (ENOPROTOOPT != WSAENOPROTOOPT)
71 # endif /* ENOPROTOOPT */
72 # if defined (EPROTONOSUPPORT) && (EPROTONOSUPPORT != WSAEPROTONOSUPPORT)
73 # undef EPROTONOSUPPORT
74 # endif /* EPROTONOSUPPORT */
75 # if defined (ESOCKTNOSUPPORT) && (ESOCKTNOSUPPORT != WSAESOCKTNOSUPPORT)
76 # undef ESOCKTNOSUPPORT
77 # endif /* ESOCKTNOSUPPORT */
78 # if defined (EOPNOTSUPP) && (EOPNOTSUPP != WSAEOPNOTSUPP)
80 # endif /* EOPNOTSUPP */
81 # if defined (EPFNOSUPPORT) && (EPFNOSUPPORT != WSAEPFNOSUPPORT)
83 # endif /* EPFNOSUPPORT */
84 # if defined (EAFNOSUPPORT) && (EAFNOSUPPORT != WSAEAFNOSUPPORT)
86 # endif /* EAFNOSUPPORT */
87 # if defined (EADDRINUSE) && (EADDRINUSE != WSAEADDRINUSE)
89 # endif /* EADDRINUSE */
90 # if defined (EADDRNOTAVAIL) && (EADDRNOTAVAIL != WSAEADDRNOTAVAIL)
92 # endif /* EADDRNOTAVAIL */
93 # if defined (ENETDOWN) && (ENETDOWN != WSAENETDOWN)
95 # endif /* ENETDOWN */
96 # if defined (ENETUNREACH) && (ENETUNREACH != WSAENETUNREACH)
98 # endif /* ENETUNREACH */
99 # if defined (ENETRESET) && (ENETRESET != WSAENETRESET)
101 # endif /* ENETRESET */
102 # if defined (ECONNABORTED) && (ECONNABORTED != WSAECONNABORTED)
104 # endif /* ECONNABORTED */
105 # if defined (ECONNRESET) && (ECONNRESET != WSAECONNRESET)
107 # endif /* ECONNRESET */
108 # if defined (ENOBUFS) && (ENOBUFS != WSAENOBUFS)
110 # endif /* ENOBUFS */
111 # if defined (EISCONN) && (EISCONN != WSAEISCONN)
113 # endif /* EISCONN */
114 # if defined (ENOTCONN) && (ENOTCONN != WSAENOTCONN)
116 # endif /* ENOTCONN */
117 # if defined (ESHUTDOWN) && (ESHUTDOWN != WSAESHUTDOWN)
119 # endif /* ESHUTDOWN */
120 # if defined (ETOOMANYREFS) && (ETOOMANYREFS != WSAETOOMANYREFS)
122 # endif /* ETOOMANYREFS */
123 # if defined (ETIMEDOUT) && (ETIMEDOUT != WSAETIMEDOUT)
125 # endif /* ETIMEDOUT */
126 # if defined (ECONNREFUSED) && (ECONNREFUSED != WSAECONNREFUSED)
128 # endif /* ECONNREFUSED */
129 # if defined (ELOOP) && (ELOOP != WSAELOOP)
132 //# if defined (ENAMETOOLONG) && (ENAMETOOLONG != WSAENAMETOOLONG)
133 //# undef ENAMETOOLONG
134 //# endif /* ENAMETOOLONG */
135 # if defined (EHOSTDOWN) && (EHOSTDOWN != WSAEHOSTDOWN)
137 # endif /* EHOSTDOWN */
138 # if defined (EHOSTUNREACH) && (EHOSTUNREACH != WSAEHOSTUNREACH)
140 # endif /* EHOSTUNREACH */
141 //# if defined (ENOTEMPTY) && (ENOTEMPTY != WSAENOTEMPTY)
143 //# endif /* ENOTEMPTY */
144 # if defined (EPROCLIM) && (EPROCLIM != WSAEPROCLIM)
146 # endif /* EPROCLIM */
147 # if defined (EUSERS) && (EUSERS != WSAEUSERS)
150 # if defined (EDQUOT) && (EDQUOT != WSAEDQUOT)
153 # if defined (ESTALE) && (ESTALE != WSAESTALE)
156 # if defined (EREMOTE) && (EREMOTE != WSAEREMOTE)
158 # endif /* EREMOTE */
160 # if !defined (ETIME)
161 # define ETIME ERROR_SEM_TIMEOUT
163 # if !defined (EWOULDBLOCK)
164 # define EWOULDBLOCK WSAEWOULDBLOCK
165 # endif /* !EWOULDBLOCK */
166 # if !defined (EINPROGRESS)
167 # define EINPROGRESS WSAEINPROGRESS
168 # endif /* !EINPROGRESS */
169 # if !defined (EALREADY)
170 # define EALREADY WSAEALREADY
171 # endif /* !EALREADY */
172 # if !defined (ENOTSOCK)
173 # define ENOTSOCK WSAENOTSOCK
174 # endif /* !ENOTSOCK */
175 # if !defined (EDESTADDRREQ)
176 # define EDESTADDRREQ WSAEDESTADDRREQ
177 # endif /* !EDESTADDRREQ */
178 # if !defined (EMSGSIZE)
179 # define EMSGSIZE WSAEMSGSIZE
180 # endif /* !EMSGSIZE */
181 # if !defined (EPROTOTYPE)
182 # define EPROTOTYPE WSAEPROTOTYPE
183 # endif /* !EPROTOTYPE */
184 # if !defined (ENOPROTOOPT)
185 # define ENOPROTOOPT WSAENOPROTOOPT
186 # endif /* !ENOPROTOOPT */
187 # if !defined (EPROTONOSUPPORT)
188 # define EPROTONOSUPPORT WSAEPROTONOSUPPORT
189 # endif /* !EPROTONOSUPPORT */
190 # if !defined (ESOCKTNOSUPPORT)
191 # define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
192 # endif /* !ESOCKTNOSUPPORT */
193 # if !defined (EOPNOTSUPP)
194 # define EOPNOTSUPP WSAEOPNOTSUPP
195 # endif /* !EOPNOTSUPP */
196 # if !defined (EPFNOSUPPORT)
197 # define EPFNOSUPPORT WSAEPFNOSUPPORT
198 # endif /* !EPFNOSUPPORT */
199 # if !defined (EAFNOSUPPORT)
200 # define EAFNOSUPPORT WSAEAFNOSUPPORT
201 # endif /* !EAFNOSUPPORT */
202 # if !defined (EADDRINUSE)
203 # define EADDRINUSE WSAEADDRINUSE
204 # endif /* !EADDRINUSE */
205 # if !defined (EADDRNOTAVAIL)
206 # define EADDRNOTAVAIL WSAEADDRNOTAVAIL
207 # endif /* !EADDRNOTAVAIL */
208 # if !defined (ENETDOWN)
209 # define ENETDOWN WSAENETDOWN
210 # endif /* !ENETDOWN */
211 # if !defined (ENETUNREACH)
212 # define ENETUNREACH WSAENETUNREACH
213 # endif /* !ENETUNREACH */
214 # if !defined (ENETRESET)
215 # define ENETRESET WSAENETRESET
216 # endif /* !ENETRESET */
217 # if !defined (ECONNABORTED)
218 # define ECONNABORTED WSAECONNABORTED
219 # endif /* !ECONNABORTED */
220 # if !defined (ECONNRESET)
221 # define ECONNRESET WSAECONNRESET
222 # endif /* !ECONNRESET */
223 # if !defined (ENOBUFS)
224 # define ENOBUFS WSAENOBUFS
225 # endif /* !ENOBUFS */
226 # if !defined (EISCONN)
227 # define EISCONN WSAEISCONN
228 # endif /* !EISCONN */
229 # if !defined (ENOTCONN)
230 # define ENOTCONN WSAENOTCONN
231 # endif /* !ENOTCONN */
232 # if !defined (ESHUTDOWN)
233 # define ESHUTDOWN WSAESHUTDOWN
234 # endif /* !ESHUTDOWN */
235 # if !defined (ETOOMANYREFS)
236 # define ETOOMANYREFS WSAETOOMANYREFS
237 # endif /* !ETOOMANYREFS */
238 # if !defined (ETIMEDOUT)
239 # define ETIMEDOUT WSAETIMEDOUT
240 # endif /* !ETIMEDOUT */
241 # if !defined (ECONNREFUSED)
242 # define ECONNREFUSED WSAECONNREFUSED
243 # endif /* !ECONNREFUSED */
244 # if !defined (ELOOP)
245 # define ELOOP WSAELOOP
247 # if !defined (EHOSTDOWN)
248 # define EHOSTDOWN WSAEHOSTDOWN
249 # endif /* !EHOSTDOWN */
250 # if !defined (EHOSTUNREACH)
251 # define EHOSTUNREACH WSAEHOSTUNREACH
252 # endif /* !EHOSTUNREACH */
253 # if !defined (EPROCLIM)
254 # define EPROCLIM WSAEPROCLIM
255 # endif /* !EPROCLIM */
256 # if !defined (EUSERS)
257 # define EUSERS WSAEUSERS
258 # endif /* !EUSERS */
259 # if !defined (EDQUOT)
260 # define EDQUOT WSAEDQUOT
261 # endif /* !EDQUOT */
262 # if !defined (ESTALE)
263 # define ESTALE WSAESTALE
264 # endif /* !ESTALE */
265 # if !defined (EREMOTE)
266 # define EREMOTE WSAEREMOTE
267 # endif /* !EREMOTE */
269 // Grrr! ENAMETOOLONG and ENOTEMPTY are already defined by the horrible
270 // 'standard' library.
271 // #define ENAMETOOLONG WSAENAMETOOLONG
272 # if !defined (EADDRINUSE)
273 # define EADDRINUSE WSAEADDRINUSE
274 # endif /* EADDRINUSE*/
277 # if !defined (EPERM)
278 # define EPERM ERROR_ACCESS_DENIED
280 #endif /* ACE_WIN32 */
282 #if defined (ACE_HAS_H_ERRNO)
283 void herror (const char *str
);
284 #endif /* ACE_HAS_H_ERRNO */
286 #if defined (ACE_DEFINE_MISSING_ERRNOS)
287 # if !defined (EPERM)
290 # if !defined (ENOENT)
293 # if !defined (ESRCH)
296 # if !defined (EINTR)
302 # if !defined (ENXIO)
305 # if !defined (E2BIG)
308 # if !defined (ENOEXEC)
310 # endif /* ENOEXEC */
311 # if !defined (EBADF)
314 # if !defined (ECHILD)
317 # if !defined (EAGAIN)
320 # if !defined (ENOMEM)
323 # if !defined (EACCES)
326 # if !defined (EFAULT)
329 # if !defined (EBUSY)
332 # if !defined (EEXIST)
335 # if !defined (EXDEV)
338 # if !defined (ENODEV)
341 # if !defined (ENOTDIR)
343 # endif /* ENOTDIR */
344 # if !defined (EISDIR)
347 # if !defined (EINVAL)
350 # if !defined (ENFILE)
353 # if !defined (EMFILE)
356 # if !defined (ENOTTY)
359 # if !defined (EFBIG)
362 # if !defined (ENOSPC)
365 # if !defined (ESPIPE)
368 # if !defined (EROFS)
371 # if !defined (EMLINK)
374 # if !defined (EPIPE)
380 # if !defined (ERANGE)
383 # if !defined (EDEADLK) && !defined (ACE_MQX) // Conflicts with EILSEQ
385 # endif /* EDEADLK */
386 # if !defined (ENAMETOOLONG)
387 # define ENAMETOOLONG 38
388 # endif /* ENAMETOOLONG */
389 # if !defined (ENOLCK)
392 # if !defined (ENOSYS)
395 # if !defined (ENOTEMPTY)
396 # define ENOTEMPTY 41
397 # endif /* ENOTEMPTY */
404 # ifndef EAFNOSUPPORT
405 # define EAFNOSUPPORT 97
408 # define EADDRINUSE 98
411 # define ENETUNREACH 101
414 # define ECONNRESET 104
422 # ifndef ECONNREFUSED
423 # define ECONNREFUSED 111
426 # define EINPROGRESS 115
429 #endif /* ACE_DEFINE_MISSING_ERRNOS */
431 #if defined (ACE_LACKS_T_ERRNO)
433 #endif /* ACE_LACKS_T_ERRNO */
435 #if !defined (ENOSYS)
436 # define ENOSYS EFAULT /* Operation not supported or unknown error. */
439 #if !defined (ENOTSUP)
440 # define ENOTSUP ENOSYS /* Operation not supported. */
441 #endif /* !ENOTSUP */
443 #if !defined (ESUCCESS)
445 #endif /* !ESUCCESS */
451 #if !defined (ENFILE)
452 # define ENFILE EMFILE /* No more socket descriptors are available. */
456 // Not the same, but ECONNABORTED is provided on NT.
457 # define ECOMM ECONNABORTED
460 #if !defined (EDEADLK)
461 # define EDEADLK (ACE_CUSTOM_ERRNO_BASE) + 1
462 #endif /* !EDEADLK */
464 #if !defined (ENXIO) /* Needed in SOCK_Dgram_Mcast */
468 #if !defined (ETIMEDOUT) && defined (ETIME)
469 # define ETIMEDOUT ETIME
470 #endif /* ETIMEDOUT */
472 #if !defined (ETIME) && defined (ETIMEDOUT)
473 # define ETIME ETIMEDOUT
480 #if !defined (ECANCELED)
481 # define ECANCELED 125
482 #endif /* ECANCELED */
485 #define ESHUTDOWN ECANCELED
489 # define EWOULDBLOCK EAGAIN
490 # define ELOOP (ACE_CUSTOM_ERRNO_BASE) + 2
495 #endif /* __cplusplus */
497 #include /**/ "ace/post.h"
498 #endif /* ACE_OS_INCLUDE_OS_ERRNO_H */