From: Jan Dubois Date: Wed, 11 Nov 2009 23:29:39 +0000 (-0800) Subject: Map winsock error codes to POSIX errno values X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2489f03d17f65312c4370377c30587ab801b844f;p=p5sagit%2Fp5-mst-13.2.git Map winsock error codes to POSIX errno values --- diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index eccbb31..5b7ade6 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -216,6 +216,129 @@ char *tzname[] = { "" , "" }; #endif /* WIN32 || NETWARE */ #endif /* __VMS */ +#ifdef WIN32 + /* Perl on Windows assigns WSAGetLastError() return values to errno + * (in win32/win32sck.c). Therefore we need to map these values + * back to standard symbolic names, as long as the same name isn't + * already defined by errno.h itself. The Errno.pm module does + * a similar mapping. + */ +# ifndef EWOULDBLOCK +# define EWOULDBLOCK WSAEWOULDBLOCK +# endif +# ifndef EINPROGRESS +# define EINPROGRESS WSAEINPROGRESS +# endif +# ifndef EALREADY +# define EALREADY WSAEALREADY +# endif +# ifndef ENOTSOCK +# define ENOTSOCK WSAENOTSOCK +# 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 +# endif +# ifndef ELOOP +# define ELOOP WSAELOOP +# endif +# ifndef ENAMETOOLONG +# define ENAMETOOLONG WSAENAMETOOLONG +# endif +# ifndef EHOSTDOWN +# define EHOSTDOWN WSAEHOSTDOWN +# endif +# ifndef EHOSTUNREACH +# define EHOSTUNREACH WSAEHOSTUNREACH +# 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 +# ifndef EDISCON +# define EDISCON WSAEDISCON +# endif +#endif + typedef int SysRet; typedef long SysRetLong; typedef sigset_t* POSIX__SigSet;