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