1*6fb12b70Safresh1 #ifndef _INC_SYS_ERRNO2 2*6fb12b70Safresh1 #define _INC_SYS_ERRNO2 3*6fb12b70Safresh1 4*6fb12b70Safresh1 /* Too late to include winsock2.h if winsock.h has already been loaded */ 5*6fb12b70Safresh1 #ifndef _WINSOCKAPI_ 6*6fb12b70Safresh1 # include <winsock2.h> 7*6fb12b70Safresh1 #endif 8*6fb12b70Safresh1 9*6fb12b70Safresh1 /* Ensure all the Exxx constants required by convert_wsa_error_to_errno() in 10*6fb12b70Safresh1 * win32/win32sck.c are defined. Many are defined in <errno.h> already (more so 11*6fb12b70Safresh1 * in VC++ 2010 and above and some MinGW/gcc-4.8 and above, which have an extra 12*6fb12b70Safresh1 * "POSIX supplement") so, for the sake of compatibility with third-party code 13*6fb12b70Safresh1 * linked into XS modules, we must be careful not to redefine them; for the 14*6fb12b70Safresh1 * remainder we define our own values, namely the corresponding WSAExxx values. 15*6fb12b70Safresh1 * 16*6fb12b70Safresh1 * These definitions are also used as a supplement to the use of <errno.h> in 17*6fb12b70Safresh1 * the Errno and POSIX modules, both of which may be used to test the value of 18*6fb12b70Safresh1 * $!, which may have these values assigned to it (via code in win32/win32sck.c 19*6fb12b70Safresh1 * and the $! case in Perl_magic_set()). It also provides numerous otherwise 20*6fb12b70Safresh1 * missing values in the (hard-coded) list of Exxx constants exported by POSIX. 21*6fb12b70Safresh1 * Finally, three of the non-standard errno.h values (actually all now in the 22*6fb12b70Safresh1 * POSIX supplement in VC10+ and some MinGW/gcc-4.8+) are used in the perl core. 23*6fb12b70Safresh1 * 24*6fb12b70Safresh1 * This list is in the same order as that in convert_wsa_error_to_errno(). A 25*6fb12b70Safresh1 * handful of WSAExxx constants used by that function have no corresponding Exxx 26*6fb12b70Safresh1 * constant in any errno.h so there is no point in making up values for them; 27*6fb12b70Safresh1 * they are just returned unchanged by that function so we do not need to worry 28*6fb12b70Safresh1 * about them here. 29*6fb12b70Safresh1 */ 30*6fb12b70Safresh1 31*6fb12b70Safresh1 /* EINTR is a standard errno.h value */ 32*6fb12b70Safresh1 /* EBADF is a standard errno.h value */ 33*6fb12b70Safresh1 /* EACCES is a standard errno.h value */ 34*6fb12b70Safresh1 /* EFAULT is a standard errno.h value */ 35*6fb12b70Safresh1 /* EINVAL is a standard errno.h value */ 36*6fb12b70Safresh1 /* EMFILE is a standard errno.h value */ 37*6fb12b70Safresh1 38*6fb12b70Safresh1 #ifndef EWOULDBLOCK /* New in VC10 */ 39*6fb12b70Safresh1 # define EWOULDBLOCK WSAEWOULDBLOCK 40*6fb12b70Safresh1 #endif 41*6fb12b70Safresh1 #ifndef EINPROGRESS /* New in VC10 */ 42*6fb12b70Safresh1 # define EINPROGRESS WSAEINPROGRESS 43*6fb12b70Safresh1 #endif 44*6fb12b70Safresh1 #ifndef EALREADY /* New in VC10 */ 45*6fb12b70Safresh1 # define EALREADY WSAEALREADY 46*6fb12b70Safresh1 #endif 47*6fb12b70Safresh1 #ifndef ENOTSOCK /* New in VC10 and needed in doio.c */ 48*6fb12b70Safresh1 # define ENOTSOCK WSAENOTSOCK 49*6fb12b70Safresh1 #endif 50*6fb12b70Safresh1 #ifndef EDESTADDRREQ /* New in VC10 */ 51*6fb12b70Safresh1 # define EDESTADDRREQ WSAEDESTADDRREQ 52*6fb12b70Safresh1 #endif 53*6fb12b70Safresh1 #ifndef EMSGSIZE /* New in VC10 */ 54*6fb12b70Safresh1 # define EMSGSIZE WSAEMSGSIZE 55*6fb12b70Safresh1 #endif 56*6fb12b70Safresh1 #ifndef EPROTOTYPE /* New in VC10 */ 57*6fb12b70Safresh1 # define EPROTOTYPE WSAEPROTOTYPE 58*6fb12b70Safresh1 #endif 59*6fb12b70Safresh1 #ifndef ENOPROTOOPT /* New in VC10 */ 60*6fb12b70Safresh1 # define ENOPROTOOPT WSAENOPROTOOPT 61*6fb12b70Safresh1 #endif 62*6fb12b70Safresh1 #ifndef EPROTONOSUPPORT /* New in VC10 */ 63*6fb12b70Safresh1 # define EPROTONOSUPPORT WSAEPROTONOSUPPORT 64*6fb12b70Safresh1 #endif 65*6fb12b70Safresh1 #ifndef ESOCKTNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */ 66*6fb12b70Safresh1 # define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT 67*6fb12b70Safresh1 #endif 68*6fb12b70Safresh1 #ifndef EOPNOTSUPP /* New in VC10 */ 69*6fb12b70Safresh1 # define EOPNOTSUPP WSAEOPNOTSUPP 70*6fb12b70Safresh1 #endif 71*6fb12b70Safresh1 #ifndef EPFNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */ 72*6fb12b70Safresh1 # define EPFNOSUPPORT WSAEPFNOSUPPORT 73*6fb12b70Safresh1 #endif 74*6fb12b70Safresh1 #ifndef EAFNOSUPPORT /* New in VC10 and needed in util.c */ 75*6fb12b70Safresh1 # define EAFNOSUPPORT WSAEAFNOSUPPORT 76*6fb12b70Safresh1 #endif 77*6fb12b70Safresh1 #ifndef EADDRINUSE /* New in VC10 */ 78*6fb12b70Safresh1 # define EADDRINUSE WSAEADDRINUSE 79*6fb12b70Safresh1 #endif 80*6fb12b70Safresh1 #ifndef EADDRNOTAVAIL /* New in VC10 */ 81*6fb12b70Safresh1 # define EADDRNOTAVAIL WSAEADDRNOTAVAIL 82*6fb12b70Safresh1 #endif 83*6fb12b70Safresh1 #ifndef ENETDOWN /* New in VC10 */ 84*6fb12b70Safresh1 # define ENETDOWN WSAENETDOWN 85*6fb12b70Safresh1 #endif 86*6fb12b70Safresh1 #ifndef ENETUNREACH /* New in VC10 */ 87*6fb12b70Safresh1 # define ENETUNREACH WSAENETUNREACH 88*6fb12b70Safresh1 #endif 89*6fb12b70Safresh1 #ifndef ENETRESET /* New in VC10 */ 90*6fb12b70Safresh1 # define ENETRESET WSAENETRESET 91*6fb12b70Safresh1 #endif 92*6fb12b70Safresh1 #ifndef ECONNABORTED /* New in VC10 and needed in util.c */ 93*6fb12b70Safresh1 # define ECONNABORTED WSAECONNABORTED 94*6fb12b70Safresh1 #endif 95*6fb12b70Safresh1 #ifndef ECONNRESET /* New in VC10 */ 96*6fb12b70Safresh1 # define ECONNRESET WSAECONNRESET 97*6fb12b70Safresh1 #endif 98*6fb12b70Safresh1 #ifndef ENOBUFS /* New in VC10 */ 99*6fb12b70Safresh1 # define ENOBUFS WSAENOBUFS 100*6fb12b70Safresh1 #endif 101*6fb12b70Safresh1 #ifndef EISCONN /* New in VC10 */ 102*6fb12b70Safresh1 # define EISCONN WSAEISCONN 103*6fb12b70Safresh1 #endif 104*6fb12b70Safresh1 #ifndef ENOTCONN /* New in VC10 */ 105*6fb12b70Safresh1 # define ENOTCONN WSAENOTCONN 106*6fb12b70Safresh1 #endif 107*6fb12b70Safresh1 #ifndef ESHUTDOWN /* Not in errno.h but wanted by POSIX.pm */ 108*6fb12b70Safresh1 # define ESHUTDOWN WSAESHUTDOWN 109*6fb12b70Safresh1 #endif 110*6fb12b70Safresh1 #ifndef ETOOMANYREFS /* Not in errno.h but wanted by POSIX.pm */ 111*6fb12b70Safresh1 # define ETOOMANYREFS WSAETOOMANYREFS 112*6fb12b70Safresh1 #endif 113*6fb12b70Safresh1 #ifndef ETIMEDOUT /* New in VC10 */ 114*6fb12b70Safresh1 # define ETIMEDOUT WSAETIMEDOUT 115*6fb12b70Safresh1 #endif 116*6fb12b70Safresh1 #ifndef ECONNREFUSED /* New in VC10 */ 117*6fb12b70Safresh1 # define ECONNREFUSED WSAECONNREFUSED 118*6fb12b70Safresh1 #endif 119*6fb12b70Safresh1 #ifndef ELOOP /* New in VC10 */ 120*6fb12b70Safresh1 # define ELOOP WSAELOOP 121*6fb12b70Safresh1 #endif 122*6fb12b70Safresh1 123*6fb12b70Safresh1 /* ENAMETOOLONG is a standard errno.h value */ 124*6fb12b70Safresh1 125*6fb12b70Safresh1 /* EHOSTDOWN is not in errno.h and despite being wanted by POSIX.pm we cannot 126*6fb12b70Safresh1 * provide any sane value since there is no WSAEHOSTDOWN */ 127*6fb12b70Safresh1 128*6fb12b70Safresh1 #ifndef EHOSTUNREACH /* New in VC10 */ 129*6fb12b70Safresh1 # define EHOSTUNREACH WSAEHOSTUNREACH 130*6fb12b70Safresh1 #endif 131*6fb12b70Safresh1 132*6fb12b70Safresh1 /* ENOTEMPTY is a standard errno.h value */ 133*6fb12b70Safresh1 134*6fb12b70Safresh1 #ifndef EPROCLIM /* Not in errno.h but wanted by POSIX.pm */ 135*6fb12b70Safresh1 # define EPROCLIM WSAEPROCLIM 136*6fb12b70Safresh1 #endif 137*6fb12b70Safresh1 #ifndef EUSERS /* Not in errno.h but wanted by POSIX.pm */ 138*6fb12b70Safresh1 # define EUSERS WSAEUSERS 139*6fb12b70Safresh1 #endif 140*6fb12b70Safresh1 #ifndef EDQUOT /* Not in errno.h but wanted by POSIX.pm */ 141*6fb12b70Safresh1 # define EDQUOT WSAEDQUOT 142*6fb12b70Safresh1 #endif 143*6fb12b70Safresh1 #ifndef ESTALE /* Not in errno.h but wanted by POSIX.pm */ 144*6fb12b70Safresh1 # define ESTALE WSAESTALE 145*6fb12b70Safresh1 #endif 146*6fb12b70Safresh1 #ifndef EREMOTE /* Not in errno.h but wanted by POSIX.pm */ 147*6fb12b70Safresh1 # define EREMOTE WSAEREMOTE 148*6fb12b70Safresh1 #endif 149*6fb12b70Safresh1 150*6fb12b70Safresh1 /* EDISCON is not an errno.h value at all */ 151*6fb12b70Safresh1 /* ENOMORE is not an errno.h value at all */ 152*6fb12b70Safresh1 153*6fb12b70Safresh1 #ifndef ECANCELED /* New in VC10 */ 154*6fb12b70Safresh1 # ifdef WSAECANCELLED /* New in WinSock2 */ 155*6fb12b70Safresh1 # define ECANCELED WSAECANCELLED 156*6fb12b70Safresh1 # endif 157*6fb12b70Safresh1 #endif 158*6fb12b70Safresh1 159*6fb12b70Safresh1 /* EINVALIDPROCTABLE is not an errno.h value at all */ 160*6fb12b70Safresh1 /* EINVALIDPROVIDER is not an errno.h value at all */ 161*6fb12b70Safresh1 /* EPROVIDERFAILEDINIT is not an errno.h value at all */ 162*6fb12b70Safresh1 /* EREFUSED is not an errno.h value at all */ 163*6fb12b70Safresh1 164*6fb12b70Safresh1 /* Set a flag indicating whether <errno.h> has the POSIX supplement (the first 165*6fb12b70Safresh1 * constant in which is EADDRINUSE). If so then we won't have just defined it as 166*6fb12b70Safresh1 * WSAEADDRINUSE above. 167*6fb12b70Safresh1 */ 168*6fb12b70Safresh1 #undef ERRNO_HAS_POSIX_SUPPLEMENT 169*6fb12b70Safresh1 #if EADDRINUSE != WSAEADDRINUSE 170*6fb12b70Safresh1 # define ERRNO_HAS_POSIX_SUPPLEMENT 171*6fb12b70Safresh1 #endif 172*6fb12b70Safresh1 173*6fb12b70Safresh1 #endif /* _INC_SYS_ERRNO2 */ 174