diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2011-03-18 17:04:35 -0700 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2011-03-19 10:15:52 -0700 |
commit | b59e75b34cef3fedd214c9b6ee744146cf8b3308 (patch) | |
tree | 5fcfe739490cbba81cc4335ecef60f8400d70e62 /win32 | |
parent | 41ef34de832ea2283fbc3b35c6da583d89497204 (diff) | |
download | perl-b59e75b34cef3fedd214c9b6ee744146cf8b3308.tar.gz |
Redefine errno values for Visual Studio 2010
Perl traditionally stores WinSock error codes (values above 10000) in
errno, with corresponding support for $! to stringify them properly.
In Visual Studio 2010 (and presumably newer Windows SDKs) Microsoft
has started to define additional errno constants in errno.h (values
between 100 and 200) with conflicting names (e.g. EWOULDBLOCK).
There are 2 ways to deal with this situation:
1) Redefine the errno.h constants back to the winsock values for
the Errno and POSIX modules.
2) Translate the winsock error codes to the new errno constants
in the socket implementation in win32/win32sck.c.
Solution 1) has the advantage that any existing Perl code that has
numeric error codes hard-coded in it will continue to work.
Solution 2) has the advantage that XS code using external libaries can
set errno to the new constants, and they will be handled consistently
in the Perl core. It will however need additional support for other
compilers and runtime libraries that don't support these new error
codes.
This commit implements solution 1).
Blame attribution: the commit message is from Jan Dubois,
the actual patch was created by Steve Hay.
Signed-off-by: Jan Dubois <jand@activestate.com>
Diffstat (limited to 'win32')
-rw-r--r-- | win32/include/sys/socket.h | 4 | ||||
-rw-r--r-- | win32/win32.h | 11 |
2 files changed, 0 insertions, 15 deletions
diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h index a396f00584..53abf0cd21 100644 --- a/win32/include/sys/socket.h +++ b/win32/include/sys/socket.h @@ -82,10 +82,6 @@ extern "C" { #endif -#ifndef ENOTSOCK -#define ENOTSOCK WSAENOTSOCK -#endif - #ifdef USE_SOCKETS_AS_HANDLES #ifndef PERL_FD_SETSIZE diff --git a/win32/win32.h b/win32/win32.h index 204a380099..4c58b8c252 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -525,17 +525,6 @@ void win32_wait_for_children(pTHX); #define EXEC_ARGV_CAST(x) ((const char *const *) x) -#if !defined(ECONNABORTED) && defined(WSAECONNABORTED) -#define ECONNABORTED WSAECONNABORTED -#endif -#if !defined(ECONNRESET) && defined(WSAECONNRESET) -#define ECONNRESET WSAECONNRESET -#endif -#if !defined(EAFNOSUPPORT) && defined(WSAEAFNOSUPPORT) -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#endif -/* Why not needed for ECONNREFUSED? --abe */ - DllExport void *win32_signal_context(void); #define PERL_GET_SIG_CONTEXT win32_signal_context() |