summaryrefslogtreecommitdiff
path: root/win32/include
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2013-09-06 10:17:54 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2013-09-16 15:37:33 +0100
commitd31f3d6062be558a1c70f31e080a94bed0f4e7aa (patch)
tree7edee1df213f063ce55bd511f961645508bda737 /win32/include
parentcd6a3131ad2bbd2f1f502de34f7a253780ee0bbd (diff)
downloadperl-d31f3d6062be558a1c70f31e080a94bed0f4e7aa.tar.gz
Simplify errno2.h slightly
There is no need for it to worry about ensuring that standard errno.h values like EINTR are defined. There is no point in it defining dummy constants like EINVALIDPROCTABLE which do not exist in errno.h at all. They would only be given the corresponding WSAExxx values anyway, so the win32sck.c function might just as well return them directly. Other constants like ESOCKTNOSUPPORT which do not exist in errno.h on Windows but presumably exist elsewhere since POSIX tries to exports them are still worth defining (where possible -- it isn't possible for EHOSTDOWN since there is no corresponding WSAEHOSTDOWN); add comments for these for clarity. Also comment which errno.h constants are new in VC10, and mention three of the four that win32/include/sys/socket.h used to redefine because they are used in the perl core (ENOTSOCK, EAFNOSUPPORT and ECONNABORTED) -- the other one (ECONNRESET) does not appear to be used in the perl core as far as I can tell.
Diffstat (limited to 'win32/include')
-rw-r--r--win32/include/sys/errno2.h166
1 files changed, 78 insertions, 88 deletions
diff --git a/win32/include/sys/errno2.h b/win32/include/sys/errno2.h
index 084e9e4f22..b4749a3188 100644
--- a/win32/include/sys/errno2.h
+++ b/win32/include/sys/errno2.h
@@ -4,166 +4,156 @@
#define _WINSOCKAPI_ /* Don't drag in everything */
#include <winsock.h>
-/* Ensure all the Exxx constants required by get_last_socket_error() in
- * win32/win32sck.c are defined. Many are defined in <errno.h> already (more in
- * VC++ 2010 and above) so, for the sake of compatibility with third-party code
- * linked into XS modules, we must be careful not to redefine them; for the
- * remainder we define our own values, namely the corresponding WSAExxx values.
+/* Ensure all the Exxx constants required by convert_wsa_error_to_errno() in
+ * win32/win32sck.c are defined. Many are defined in <errno.h> already (more so
+ * in VC++ 2010 and above, which have an extra "POSIX supplement") so, for the
+ * sake of compatibility with third-party code linked into XS modules, we must
+ * be careful not to redefine them; for the remainder we define our own values,
+ * namely the corresponding WSAExxx values.
+ *
* These definitions are also used as a supplement to the use of <errno.h> in
* the Errno and POSIX modules, both of which may be used to test the value of
- * $!, which may have these values assigned to it (via win32/win32sck.c). It
- * also provides numerous otherwise missing values in the (hard-coded) list of
- * Exxx constants exported by POSIX.
+ * $!, which may have these values assigned to it (via code in win32/win32sck.c
+ * and the $! case in Perl_magic_set()). It also provides numerous otherwise
+ * missing values in the (hard-coded) list of Exxx constants exported by POSIX.
+ * Finally, three of the non-standard errno.h values (actually all now in the
+ * POSIX supplement in VC10+) are used in the perl core.
+ *
+ * This list is in the same order as that in convert_wsa_error_to_errno(). A
+ * handful of WSAExxx constants used by that function have no corresponding Exxx
+ * constant in any errno.h so there is no point in making up values for them;
+ * they are just returned unchanged by that function so we do not need to worry
+ * about them here.
*/
-#ifndef EINTR
-# define EINTR WSAEINTR
-#endif
-#ifndef EBADF
-# define EBADF WSAEBADF
-#endif
-#ifndef EACCES
-# define EACCES WSAEACCES
-#endif
-#ifndef EFAULT
-# define EFAULT WSAEFAULT
-#endif
-#ifndef EINVAL
-# define EINVAL WSAEINVAL
-#endif
-#ifndef EMFILE
-# define EMFILE WSAEMFILE
-#endif
-#ifndef EWOULDBLOCK
+
+/* EINTR is a standard errno.h value */
+/* EBADF is a standard errno.h value */
+/* EACCES is a standard errno.h value */
+/* EFAULT is a standard errno.h value */
+/* EINVAL is a standard errno.h value */
+/* EMFILE is a standard errno.h value */
+
+#ifndef EWOULDBLOCK /* New in VC10 */
# define EWOULDBLOCK WSAEWOULDBLOCK
#endif
-#ifndef EINPROGRESS
+#ifndef EINPROGRESS /* New in VC10 */
# define EINPROGRESS WSAEINPROGRESS
#endif
-#ifndef EALREADY
+#ifndef EALREADY /* New in VC10 */
# define EALREADY WSAEALREADY
#endif
-#ifndef ENOTSOCK
+#ifndef ENOTSOCK /* New in VC10 and needed in doio.c */
# define ENOTSOCK WSAENOTSOCK
#endif
-#ifndef EDESTADDRREQ
+#ifndef EDESTADDRREQ /* New in VC10 */
# define EDESTADDRREQ WSAEDESTADDRREQ
#endif
-#ifndef EMSGSIZE
+#ifndef EMSGSIZE /* New in VC10 */
# define EMSGSIZE WSAEMSGSIZE
#endif
-#ifndef EPROTOTYPE
+#ifndef EPROTOTYPE /* New in VC10 */
# define EPROTOTYPE WSAEPROTOTYPE
#endif
-#ifndef ENOPROTOOPT
+#ifndef ENOPROTOOPT /* New in VC10 */
# define ENOPROTOOPT WSAENOPROTOOPT
#endif
-#ifndef EPROTONOSUPPORT
+#ifndef EPROTONOSUPPORT /* New in VC10 */
# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#endif
-#ifndef ESOCKTNOSUPPORT
+#ifndef ESOCKTNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */
# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
#endif
-#ifndef EOPNOTSUPP
+#ifndef EOPNOTSUPP /* New in VC10 */
# define EOPNOTSUPP WSAEOPNOTSUPP
#endif
-#ifndef EPFNOSUPPORT
+#ifndef EPFNOSUPPORT /* Not in errno.h but wanted by POSIX.pm */
# define EPFNOSUPPORT WSAEPFNOSUPPORT
#endif
-#ifndef EAFNOSUPPORT
+#ifndef EAFNOSUPPORT /* New in VC10 and needed in util.c */
# define EAFNOSUPPORT WSAEAFNOSUPPORT
#endif
-#ifndef EADDRINUSE
+#ifndef EADDRINUSE /* New in VC10 */
# define EADDRINUSE WSAEADDRINUSE
#endif
-#ifndef EADDRNOTAVAIL
+#ifndef EADDRNOTAVAIL /* New in VC10 */
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#endif
-#ifndef ENETDOWN
+#ifndef ENETDOWN /* New in VC10 */
# define ENETDOWN WSAENETDOWN
#endif
-#ifndef ENETUNREACH
+#ifndef ENETUNREACH /* New in VC10 */
# define ENETUNREACH WSAENETUNREACH
#endif
-#ifndef ENETRESET
+#ifndef ENETRESET /* New in VC10 */
# define ENETRESET WSAENETRESET
#endif
-#ifndef ECONNABORTED
+#ifndef ECONNABORTED /* New in VC10 and needed in util.c */
# define ECONNABORTED WSAECONNABORTED
#endif
-#ifndef ECONNRESET
+#ifndef ECONNRESET /* New in VC10 */
# define ECONNRESET WSAECONNRESET
#endif
-#ifndef ENOBUFS
+#ifndef ENOBUFS /* New in VC10 */
# define ENOBUFS WSAENOBUFS
#endif
-#ifndef EISCONN
+#ifndef EISCONN /* New in VC10 */
# define EISCONN WSAEISCONN
#endif
-#ifndef ENOTCONN
+#ifndef ENOTCONN /* New in VC10 */
# define ENOTCONN WSAENOTCONN
#endif
-#ifndef ESHUTDOWN
+#ifndef ESHUTDOWN /* Not in errno.h but wanted by POSIX.pm */
# define ESHUTDOWN WSAESHUTDOWN
#endif
-#ifndef ETOOMANYREFS
+#ifndef ETOOMANYREFS /* Not in errno.h but wanted by POSIX.pm */
# define ETOOMANYREFS WSAETOOMANYREFS
#endif
-#ifndef ETIMEDOUT
+#ifndef ETIMEDOUT /* New in VC10 */
# define ETIMEDOUT WSAETIMEDOUT
#endif
-#ifndef ECONNREFUSED
+#ifndef ECONNREFUSED /* New in VC10 */
# define ECONNREFUSED WSAECONNREFUSED
#endif
-#ifndef ELOOP
+#ifndef ELOOP /* New in VC10 */
# define ELOOP WSAELOOP
#endif
-#ifndef ENAMETOOLONG
-# define ENAMETOOLONG WSAENAMETOOLONG
-#endif
-#ifndef EHOSTDOWN
-# define EHOSTDOWN WSAEHOSTDOWN
-#endif
-#ifndef EHOSTUNREACH
+
+/* ENAMETOOLONG is a standard errno.h value */
+
+/* EHOSTDOWN is not an errno.h value at all (on Windows, anyway) */
+
+#ifndef EHOSTUNREACH /* New in VC10 */
# define EHOSTUNREACH WSAEHOSTUNREACH
#endif
-#ifndef ENOTEMPTY
-# define ENOTEMPTY WSAENOTEMPTY
-#endif
-#ifndef EPROCLIM
+
+/* ENOTEMPTY is a standard errno.h value */
+
+#ifndef EPROCLIM /* Not in errno.h but wanted by POSIX.pm */
# define EPROCLIM WSAEPROCLIM
#endif
-#ifndef EUSERS
+#ifndef EUSERS /* Not in errno.h but wanted by POSIX.pm */
# define EUSERS WSAEUSERS
#endif
-#ifndef EDQUOT
+#ifndef EDQUOT /* Not in errno.h but wanted by POSIX.pm */
# define EDQUOT WSAEDQUOT
#endif
-#ifndef ESTALE
+#ifndef ESTALE /* Not in errno.h but wanted by POSIX.pm */
# define ESTALE WSAESTALE
#endif
-#ifndef EREMOTE
+#ifndef EREMOTE /* Not in errno.h but wanted by POSIX.pm */
# define EREMOTE WSAEREMOTE
#endif
-#ifndef EDISCON
-# define EDISCON WSAEDISCON
-#endif
-#ifndef ENOMORE
-# define ENOMORE WSAENOMORE
-#endif
-#ifndef ECANCELED
+
+/* EDISCON is not an errno.h value at all */
+/* ENOMORE is not an errno.h value at all */
+
+#ifndef ECANCELED /* New in VC10 */
# define ECANCELED WSAECANCELLED
#endif
-#ifndef EINVALIDPROCTABLE
-# define EINVALIDPROCTABLE WSAEINVALIDPROCTABLE
-#endif
-#ifndef EINVALIDPROVIDER
-# define EINVALIDPROVIDER WSAEINVALIDPROVIDER
-#endif
-#ifndef EPROVIDERFAILEDINIT
-# define EPROVIDERFAILEDINIT WSAEPROVIDERFAILEDINIT
-#endif
-#ifndef EREFUSED
-# define EREFUSED WSAEREFUSED
-#endif
+
+/* EINVALIDPROCTABLE is not an errno.h value at all */
+/* EINVALIDPROVIDER is not an errno.h value at all */
+/* EPROVIDERFAILEDINIT is not an errno.h value at all */
+/* EREFUSED is not an errno.h value at all */
#endif /* _INC_SYS_ERRNO2 */