/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef TOOLKIT_ERRNO_H_ #define TOOLKIT_ERRNO_H_ #include #if EDOM > 0 # define TOOLKIT__ERR(x) (-(x)) #else # define TOOLKIT__ERR(x) (x) #endif #define TOOLKIT__EOF (-4095) #define TOOLKIT__UNKNOWN (-4094) #define TOOLKIT__EAI_ADDRFAMILY (-3000) #define TOOLKIT__EAI_AGAIN (-3001) #define TOOLKIT__EAI_BADFLAGS (-3002) #define TOOLKIT__EAI_CANCELED (-3003) #define TOOLKIT__EAI_FAIL (-3004) #define TOOLKIT__EAI_FAMILY (-3005) #define TOOLKIT__EAI_MEMORY (-3006) #define TOOLKIT__EAI_NODATA (-3007) #define TOOLKIT__EAI_NONAME (-3008) #define TOOLKIT__EAI_OVERFLOW (-3009) #define TOOLKIT__EAI_SERVICE (-3010) #define TOOLKIT__EAI_SOCKTYPE (-3011) #define TOOLKIT__EAI_BADHINTS (-3013) #define TOOLKIT__EAI_PROTOCOL (-3014) /* Only map to the system errno on non-Windows platforms. It's apparently * a fairly common practice for Windows programmers to redefine errno codes. */ #if defined(E2BIG) && !defined(_WIN32) # define TOOLKIT__E2BIG TOOLKIT__ERR(E2BIG) #else # define TOOLKIT__E2BIG (-4093) #endif #if defined(EACCES) && !defined(_WIN32) # define TOOLKIT__EACCES TOOLKIT__ERR(EACCES) #else # define TOOLKIT__EACCES (-4092) #endif #if defined(EADDRINUSE) && !defined(_WIN32) # define TOOLKIT__EADDRINUSE TOOLKIT__ERR(EADDRINUSE) #else # define TOOLKIT__EADDRINUSE (-4091) #endif #if defined(EADDRNOTAVAIL) && !defined(_WIN32) # define TOOLKIT__EADDRNOTAVAIL TOOLKIT__ERR(EADDRNOTAVAIL) #else # define TOOLKIT__EADDRNOTAVAIL (-4090) #endif #if defined(EAFNOSUPPORT) && !defined(_WIN32) # define TOOLKIT__EAFNOSUPPORT TOOLKIT__ERR(EAFNOSUPPORT) #else # define TOOLKIT__EAFNOSUPPORT (-4089) #endif #if defined(EAGAIN) && !defined(_WIN32) # define TOOLKIT__EAGAIN TOOLKIT__ERR(EAGAIN) #else # define TOOLKIT__EAGAIN (-4088) #endif #if defined(EALREADY) && !defined(_WIN32) # define TOOLKIT__EALREADY TOOLKIT__ERR(EALREADY) #else # define TOOLKIT__EALREADY (-4084) #endif #if defined(EBADF) && !defined(_WIN32) # define TOOLKIT__EBADF TOOLKIT__ERR(EBADF) #else # define TOOLKIT__EBADF (-4083) #endif #if defined(EBUSY) && !defined(_WIN32) # define TOOLKIT__EBUSY TOOLKIT__ERR(EBUSY) #else # define TOOLKIT__EBUSY (-4082) #endif #if defined(ECANCELED) && !defined(_WIN32) # define TOOLKIT__ECANCELED TOOLKIT__ERR(ECANCELED) #else # define TOOLKIT__ECANCELED (-4081) #endif #if defined(ECHARSET) && !defined(_WIN32) # define TOOLKIT__ECHARSET TOOLKIT__ERR(ECHARSET) #else # define TOOLKIT__ECHARSET (-4080) #endif #if defined(ECONNABORTED) && !defined(_WIN32) # define TOOLKIT__ECONNABORTED TOOLKIT__ERR(ECONNABORTED) #else # define TOOLKIT__ECONNABORTED (-4079) #endif #if defined(ECONNREFUSED) && !defined(_WIN32) # define TOOLKIT__ECONNREFUSED TOOLKIT__ERR(ECONNREFUSED) #else # define TOOLKIT__ECONNREFUSED (-4078) #endif #if defined(ECONNRESET) && !defined(_WIN32) # define TOOLKIT__ECONNRESET TOOLKIT__ERR(ECONNRESET) #else # define TOOLKIT__ECONNRESET (-4077) #endif #if defined(EDESTADDRREQ) && !defined(_WIN32) # define TOOLKIT__EDESTADDRREQ TOOLKIT__ERR(EDESTADDRREQ) #else # define TOOLKIT__EDESTADDRREQ (-4076) #endif #if defined(EEXIST) && !defined(_WIN32) # define TOOLKIT__EEXIST TOOLKIT__ERR(EEXIST) #else # define TOOLKIT__EEXIST (-4075) #endif #if defined(EFAULT) && !defined(_WIN32) # define TOOLKIT__EFAULT TOOLKIT__ERR(EFAULT) #else # define TOOLKIT__EFAULT (-4074) #endif #if defined(EHOSTUNREACH) && !defined(_WIN32) # define TOOLKIT__EHOSTUNREACH TOOLKIT__ERR(EHOSTUNREACH) #else # define TOOLKIT__EHOSTUNREACH (-4073) #endif #if defined(EINTR) && !defined(_WIN32) # define TOOLKIT__EINTR TOOLKIT__ERR(EINTR) #else # define TOOLKIT__EINTR (-4072) #endif #if defined(EINVAL) && !defined(_WIN32) # define TOOLKIT__EINVAL TOOLKIT__ERR(EINVAL) #else # define TOOLKIT__EINVAL (-4071) #endif #if defined(EIO) && !defined(_WIN32) # define TOOLKIT__EIO TOOLKIT__ERR(EIO) #else # define TOOLKIT__EIO (-4070) #endif #if defined(EISCONN) && !defined(_WIN32) # define TOOLKIT__EISCONN TOOLKIT__ERR(EISCONN) #else # define TOOLKIT__EISCONN (-4069) #endif #if defined(EISDIR) && !defined(_WIN32) # define TOOLKIT__EISDIR TOOLKIT__ERR(EISDIR) #else # define TOOLKIT__EISDIR (-4068) #endif #if defined(ELOOP) && !defined(_WIN32) # define TOOLKIT__ELOOP TOOLKIT__ERR(ELOOP) #else # define TOOLKIT__ELOOP (-4067) #endif #if defined(EMFILE) && !defined(_WIN32) # define TOOLKIT__EMFILE TOOLKIT__ERR(EMFILE) #else # define TOOLKIT__EMFILE (-4066) #endif #if defined(EMSGSIZE) && !defined(_WIN32) # define TOOLKIT__EMSGSIZE TOOLKIT__ERR(EMSGSIZE) #else # define TOOLKIT__EMSGSIZE (-4065) #endif #if defined(ENAMETOOLONG) && !defined(_WIN32) # define TOOLKIT__ENAMETOOLONG TOOLKIT__ERR(ENAMETOOLONG) #else # define TOOLKIT__ENAMETOOLONG (-4064) #endif #if defined(ENETDOWN) && !defined(_WIN32) # define TOOLKIT__ENETDOWN TOOLKIT__ERR(ENETDOWN) #else # define TOOLKIT__ENETDOWN (-4063) #endif #if defined(ENETUNREACH) && !defined(_WIN32) # define TOOLKIT__ENETUNREACH TOOLKIT__ERR(ENETUNREACH) #else # define TOOLKIT__ENETUNREACH (-4062) #endif #if defined(ENFILE) && !defined(_WIN32) # define TOOLKIT__ENFILE TOOLKIT__ERR(ENFILE) #else # define TOOLKIT__ENFILE (-4061) #endif #if defined(ENOBUFS) && !defined(_WIN32) # define TOOLKIT__ENOBUFS TOOLKIT__ERR(ENOBUFS) #else # define TOOLKIT__ENOBUFS (-4060) #endif #if defined(ENODEV) && !defined(_WIN32) # define TOOLKIT__ENODEV TOOLKIT__ERR(ENODEV) #else # define TOOLKIT__ENODEV (-4059) #endif #if defined(ENOENT) && !defined(_WIN32) # define TOOLKIT__ENOENT TOOLKIT__ERR(ENOENT) #else # define TOOLKIT__ENOENT (-4058) #endif #if defined(ENOMEM) && !defined(_WIN32) # define TOOLKIT__ENOMEM TOOLKIT__ERR(ENOMEM) #else # define TOOLKIT__ENOMEM (-4057) #endif #if defined(ENONET) && !defined(_WIN32) # define TOOLKIT__ENONET TOOLKIT__ERR(ENONET) #else # define TOOLKIT__ENONET (-4056) #endif #if defined(ENOSPC) && !defined(_WIN32) # define TOOLKIT__ENOSPC TOOLKIT__ERR(ENOSPC) #else # define TOOLKIT__ENOSPC (-4055) #endif #if defined(ENOSYS) && !defined(_WIN32) # define TOOLKIT__ENOSYS TOOLKIT__ERR(ENOSYS) #else # define TOOLKIT__ENOSYS (-4054) #endif #if defined(ENOTCONN) && !defined(_WIN32) # define TOOLKIT__ENOTCONN TOOLKIT__ERR(ENOTCONN) #else # define TOOLKIT__ENOTCONN (-4053) #endif #if defined(ENOTDIR) && !defined(_WIN32) # define TOOLKIT__ENOTDIR TOOLKIT__ERR(ENOTDIR) #else # define TOOLKIT__ENOTDIR (-4052) #endif #if defined(ENOTEMPTY) && !defined(_WIN32) # define TOOLKIT__ENOTEMPTY TOOLKIT__ERR(ENOTEMPTY) #else # define TOOLKIT__ENOTEMPTY (-4051) #endif #if defined(ENOTSOCK) && !defined(_WIN32) # define TOOLKIT__ENOTSOCK TOOLKIT__ERR(ENOTSOCK) #else # define TOOLKIT__ENOTSOCK (-4050) #endif #if defined(ENOTSUP) && !defined(_WIN32) # define TOOLKIT__ENOTSUP TOOLKIT__ERR(ENOTSUP) #else # define TOOLKIT__ENOTSUP (-4049) #endif #if defined(EPERM) && !defined(_WIN32) # define TOOLKIT__EPERM TOOLKIT__ERR(EPERM) #else # define TOOLKIT__EPERM (-4048) #endif #if defined(EPIPE) && !defined(_WIN32) # define TOOLKIT__EPIPE TOOLKIT__ERR(EPIPE) #else # define TOOLKIT__EPIPE (-4047) #endif #if defined(EPROTO) && !defined(_WIN32) # define TOOLKIT__EPROTO TOOLKIT__ERR(EPROTO) #else # define TOOLKIT__EPROTO TOOLKIT__ERR(4046) #endif #if defined(EPROTONOSUPPORT) && !defined(_WIN32) # define TOOLKIT__EPROTONOSUPPORT TOOLKIT__ERR(EPROTONOSUPPORT) #else # define TOOLKIT__EPROTONOSUPPORT (-4045) #endif #if defined(EPROTOTYPE) && !defined(_WIN32) # define TOOLKIT__EPROTOTYPE TOOLKIT__ERR(EPROTOTYPE) #else # define TOOLKIT__EPROTOTYPE (-4044) #endif #if defined(EROFS) && !defined(_WIN32) # define TOOLKIT__EROFS TOOLKIT__ERR(EROFS) #else # define TOOLKIT__EROFS (-4043) #endif #if defined(ESHUTDOWN) && !defined(_WIN32) # define TOOLKIT__ESHUTDOWN TOOLKIT__ERR(ESHUTDOWN) #else # define TOOLKIT__ESHUTDOWN (-4042) #endif #if defined(ESPIPE) && !defined(_WIN32) # define TOOLKIT__ESPIPE TOOLKIT__ERR(ESPIPE) #else # define TOOLKIT__ESPIPE (-4041) #endif #if defined(ESRCH) && !defined(_WIN32) # define TOOLKIT__ESRCH TOOLKIT__ERR(ESRCH) #else # define TOOLKIT__ESRCH (-4040) #endif #if defined(ETIMEDOUT) && !defined(_WIN32) # define TOOLKIT__ETIMEDOUT TOOLKIT__ERR(ETIMEDOUT) #else # define TOOLKIT__ETIMEDOUT (-4039) #endif #if defined(ETXTBSY) && !defined(_WIN32) # define TOOLKIT__ETXTBSY TOOLKIT__ERR(ETXTBSY) #else # define TOOLKIT__ETXTBSY (-4038) #endif #if defined(EXDEV) && !defined(_WIN32) # define TOOLKIT__EXDEV TOOLKIT__ERR(EXDEV) #else # define TOOLKIT__EXDEV (-4037) #endif #if defined(EFBIG) && !defined(_WIN32) # define TOOLKIT__EFBIG TOOLKIT__ERR(EFBIG) #else # define TOOLKIT__EFBIG (-4036) #endif #if defined(ENOPROTOOPT) && !defined(_WIN32) # define TOOLKIT__ENOPROTOOPT TOOLKIT__ERR(ENOPROTOOPT) #else # define TOOLKIT__ENOPROTOOPT (-4035) #endif #if defined(ERANGE) && !defined(_WIN32) # define TOOLKIT__ERANGE TOOLKIT__ERR(ERANGE) #else # define TOOLKIT__ERANGE (-4034) #endif #if defined(ENXIO) && !defined(_WIN32) # define TOOLKIT__ENXIO TOOLKIT__ERR(ENXIO) #else # define TOOLKIT__ENXIO (-4033) #endif #if defined(EMLINK) && !defined(_WIN32) # define TOOLKIT__EMLINK TOOLKIT__ERR(EMLINK) #else # define TOOLKIT__EMLINK (-4032) #endif /* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is * defined. Fortunately, its value is always 64 so it's possible albeit * icky to hard-code it. */ #if defined(EHOSTDOWN) && !defined(_WIN32) # define TOOLKIT__EHOSTDOWN TOOLKIT__ERR(EHOSTDOWN) #elif defined(__APPLE__) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ defined(__NetBSD__) || \ defined(__OpenBSD__) # define TOOLKIT__EHOSTDOWN (-64) #else # define TOOLKIT__EHOSTDOWN (-4031) #endif #if defined(EREMOTEIO) && !defined(_WIN32) # define TOOLKIT__EREMOTEIO TOOLKIT__ERR(EREMOTEIO) #else # define TOOLKIT__EREMOTEIO (-4030) #endif #if defined(ENOTTY) && !defined(_WIN32) # define TOOLKIT__ENOTTY TOOLKIT__ERR(ENOTTY) #else # define TOOLKIT__ENOTTY (-4029) #endif #if defined(EFTYPE) && !defined(_WIN32) # define TOOLKIT__EFTYPE TOOLKIT__ERR(EFTYPE) #else # define TOOLKIT__EFTYPE (-4028) #endif #if defined(EILSEQ) && !defined(_WIN32) # define TOOLKIT__EILSEQ TOOLKIT__ERR(EILSEQ) #else # define TOOLKIT__EILSEQ (-4027) #endif #endif /* TOOLKIT_ERRNO_H_ */