From f631a11f5e9ab50e62b3aaebbff9ef200ac799fe Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 1 Aug 2011 11:05:51 -0400 Subject: [PATCH] Windows: conditionalize mappings of error values Visual Studio 10 adds a large number of additional POSIX C99 error values to errno.h. Wrap each mapping with #ifndef to ensure that we do not redefine the C runtime errno.h definition. Change-Id: Ia6929d9ff84358059efcc4a53dcc91ee2612fc5a Reviewed-on: http://gerrit.openafs.org/5129 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/util/errmap_nt.h | 96 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/src/util/errmap_nt.h b/src/util/errmap_nt.h index 9f8b692c7..6e9dd66fa 100644 --- a/src/util/errmap_nt.h +++ b/src/util/errmap_nt.h @@ -13,61 +13,131 @@ /* Declare NT to Unix-ish error translation function */ extern int nterr_nt2unix(long ntErr, int defaultErr); -/* Include native error code definitions */ +/* Include C Runtime Library error code definitions */ #include -/* Define additional local codes beyond NT errno range. */ +/* + * Define additional POSIX codes not specified by + * Visual Studio. Different versions include different + * error code definitions. If an error is not declared + * by the C Runtime Library, define it using the equivalent + * Winsock error. If there is no Winsock equivalent, + * define an AFS private value in the Winsock space. + */ /* Overloaded codes. */ #ifndef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK #endif +#ifndef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS +#endif +#ifndef EALREADY #define EALREADY WSAEALREADY +#endif +#ifndef ENOTSOCK #define ENOTSOCK WSAENOTSOCK -#define EDESTADDRREQ WSAEDESTADDRREQ +#endif +#ifndef EDESTADDRREQ +#define EDESTADDRREQ WSAEDESTADDRREQ +#endif +#ifndef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE +#endif +#ifndef EPROTOTYPE #define EPROTOTYPE WSAEPROTOTYPE +#endif +#ifndef ENOPROTOOPT #define ENOPROTOOPT WSAENOPROTOOPT +#endif +#ifndef EPROTONOSUPPORT #define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#endif +#ifndef ESOCKTNOSUPPORT #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#endif +#ifndef EOPNOTSUPP #define EOPNOTSUPP WSAEOPNOTSUPP +#endif +#ifndef EPFNOSUPPORT #define EPFNOSUPPORT WSAEPFNOSUPPORT +#endif +#ifndef EAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT +#endif +#ifndef EADDRINUSE #define EADDRINUSE WSAEADDRINUSE +#endif +#ifndef EADDRNOTAVAIL #define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#endif +#ifndef ENETDOWN #define ENETDOWN WSAENETDOWN +#endif +#ifndef ENETUNREACH #define ENETUNREACH WSAENETUNREACH +#endif +#ifndef ENETRESET #define ENETRESET WSAENETRESET +#endif +#ifndef ECONNABORTED #define ECONNABORTED WSAECONNABORTED +#endif +#ifndef ECONNRESET #define ECONNRESET WSAECONNRESET +#endif +#ifndef ENOBUFS #define ENOBUFS WSAENOBUFS +#endif +#ifndef EISCONN #define EISCONN WSAEISCONN +#endif +#ifndef ENOTCONN #define ENOTCONN WSAENOTCONN +#endif +#ifndef ESHUTDOWN #define ESHUTDOWN WSAESHUTDOWN +#endif +#ifndef ETOOMANYREFS #define ETOOMANYREFS WSAETOOMANYREFS +#endif +#ifndef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT +#endif +#ifndef ECONNREFUSED #define ECONNREFUSED WSAECONNREFUSED -#ifdef ELOOP -#undef ELOOP #endif +#ifndef ELOOP #define ELOOP WSAELOOP -#ifdef ENAMETOOLONG -#undef ENAMETOOLONG #endif +#ifndef ENAMETOOLONG #define ENAMETOOLONG WSAENAMETOOLONG +#endif +#ifndef EHOSTDOWN #define EHOSTDOWN WSAEHOSTDOWN +#endif +#ifndef EHOSTUNREACH #define EHOSTUNREACH WSAEHOSTUNREACH -#ifdef ENOTEMPTY -#undef ENOTEMPTY #endif +#ifndef ENOTEMPTY #define ENOTEMPTY WSAENOTEMPTY +#endif +#ifndef EPROCLIM #define EPROCLIM WSAEPROCLIM +#endif +#ifndef EUSERS #define EUSERS WSAEUSERS +#endif +#ifndef EDQUOT #define EDQUOT WSAEDQUOT +#endif +#ifndef ESTALE #define ESTALE WSAESTALE +#endif +#ifndef EREMOTE #define EREMOTE WSAEREMOTE +#endif /* * New codes @@ -75,10 +145,18 @@ extern int nterr_nt2unix(long ntErr, int defaultErr); */ #define AFS_NT_ERRNO_BASE WSABASEERR + 1100 +#ifndef EOVERFLOW #define EOVERFLOW (AFS_NT_ERRNO_BASE + 0) +#endif +#ifndef ENOMSG #define ENOMSG (AFS_NT_ERRNO_BASE + 1) +#endif +#ifndef ETIME #define ETIME (AFS_NT_ERRNO_BASE + 2) +#endif +#ifndef ENOTBLK #define ENOTBLK (AFS_NT_ERRNO_BASE + 3) +#endif #endif /* OPENAFS_ERRMAP_NT_H */ -- 2.39.5