In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/72e6b643d040f276d474b709b942bdd8d03bc2a2?hp=1af70165a5e66fcde5decf8b027291ef927e4b2b>

- Log -----------------------------------------------------------------
commit 72e6b643d040f276d474b709b942bdd8d03bc2a2
Author: Steve Hay <[email protected]>
Date:   Fri Sep 28 09:02:31 2012 +0100

    Remove option to build without USE_SOCKETS_AS_HANDLES on Windows
    
    The option is always defined by default and can't be disabled from the
    makefiles. Manually disabling it causes several tests to fail, which
    nobody has reported, so we presume nobody does this. The non-default
    configuration is believed to be historical cruft with no value now, and
    has clearly bitrotted in recent years (hence the test failures), so
    remove it to simplify the codebase slightly.
-----------------------------------------------------------------------

Summary of changes:
 XSUB.h                     |   22 +++++++--------
 win32/include/sys/socket.h |   14 ---------
 win32/win32.c              |    5 ---
 win32/win32.h              |    9 ------
 win32/win32sck.c           |   64 ++-----------------------------------------
 5 files changed, 13 insertions(+), 101 deletions(-)

diff --git a/XSUB.h b/XSUB.h
index e54b28c..e5614fb 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -635,18 +635,16 @@ Rethrows a previously caught exception.  See 
L<perlguts/"Exception Handling">.
 #    define socketpair         PerlSock_socketpair
 #      endif   /* NETWARE && USE_STDIO */
 
-#    ifdef USE_SOCKETS_AS_HANDLES
-#      undef fd_set
-#      undef FD_SET
-#      undef FD_CLR
-#      undef FD_ISSET
-#      undef FD_ZERO
-#      define fd_set           Perl_fd_set
-#      define FD_SET(n,p)      PERL_FD_SET(n,p)
-#      define FD_CLR(n,p)      PERL_FD_CLR(n,p)
-#      define FD_ISSET(n,p)    PERL_FD_ISSET(n,p)
-#      define FD_ZERO(p)       PERL_FD_ZERO(p)
-#    endif     /* USE_SOCKETS_AS_HANDLES */
+#    undef fd_set
+#    undef FD_SET
+#    undef FD_CLR
+#    undef FD_ISSET
+#    undef FD_ZERO
+#    define fd_set             Perl_fd_set
+#    define FD_SET(n,p)                PERL_FD_SET(n,p)
+#    define FD_CLR(n,p)                PERL_FD_CLR(n,p)
+#    define FD_ISSET(n,p)      PERL_FD_ISSET(n,p)
+#    define FD_ZERO(p)         PERL_FD_ZERO(p)
 
 #  endif  /* NO_XSLOCKS */
 #endif  /* PERL_IMPLICIT_SYS && !PERL_CORE */
diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h
index 26a92c7..6009572 100644
--- a/win32/include/sys/socket.h
+++ b/win32/include/sys/socket.h
@@ -195,8 +195,6 @@ extern "C" {
 #undef EAFNOSUPPORT
 #define EAFNOSUPPORT WSAEAFNOSUPPORT
 
-#ifdef USE_SOCKETS_AS_HANDLES
-
 #ifndef PERL_FD_SETSIZE
 #define PERL_FD_SETSIZE                64
 #endif
@@ -221,16 +219,6 @@ typedef struct     Perl_fd_set {
 #define PERL_FD_ISSET(n,p) \
     ((p)->bits[(n)/PERL_NFDBITS] &   ((unsigned)1 << ((n)%PERL_NFDBITS)))
 
-#else  /* USE_SOCKETS_AS_HANDLES */
-
-#define Perl_fd_set    fd_set
-#define PERL_FD_SET(n,p)       FD_SET(n,p)
-#define PERL_FD_CLR(n,p)       FD_CLR(n,p)
-#define PERL_FD_ISSET(n,p)     FD_ISSET(n,p)
-#define PERL_FD_ZERO(p)                FD_ZERO(p)
-
-#endif /* USE_SOCKETS_AS_HANDLES */
-
 SOCKET win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
 int win32_bind (SOCKET s, const struct sockaddr *addr, int namelen);
 int win32_closesocket (SOCKET s);
@@ -331,7 +319,6 @@ void win32_endservent(void);
 #define setprotoent    win32_setprotoent
 #define setservent     win32_setservent
 
-#ifdef USE_SOCKETS_AS_HANDLES
 #undef fd_set
 #undef FD_SET
 #undef FD_CLR
@@ -342,7 +329,6 @@ void win32_endservent(void);
 #define FD_CLR(n,p)    PERL_FD_CLR(n,p)
 #define FD_ISSET(n,p)  PERL_FD_ISSET(n,p)
 #define FD_ZERO(p)     PERL_FD_ZERO(p)
-#endif /* USE_SOCKETS_AS_HANDLES */
 
 #endif /* WIN32SCK_IS_STDSCK */
 
diff --git a/win32/win32.c b/win32/win32.c
index 8bb1369..56dbd15 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2703,11 +2703,6 @@ win32_fopen(const char *filename, const char *mode)
     return f;
 }
 
-#ifndef USE_SOCKETS_AS_HANDLES
-#undef fdopen
-#define fdopen my_fdopen
-#endif
-
 DllExport FILE *
 win32_fdopen(int handle, const char *mode)
 {
diff --git a/win32/win32.h b/win32/win32.h
index 93331c0..918b489 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -156,10 +156,6 @@ struct utsname {
 #define  DOSISH                1               /* no escaping our roots */
 #define  OP_BINARY     O_BINARY        /* mistake in in pp_sys.c? */
 
-/* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as
- * real filehandles. XXX Should always be defined (the other version is 
untested) */
-#define USE_SOCKETS_AS_HANDLES
-
 /* read() and write() aren't transparent for socket handles */
 #define PERL_SOCK_SYSREAD_IS_RECV
 #define PERL_SOCK_SYSWRITE_IS_SEND
@@ -322,9 +318,6 @@ typedef struct {
 DllExport void         win32_get_child_IO(child_IO_table* ptr);
 DllExport HWND         win32_create_message_window(void);
 
-#ifndef USE_SOCKETS_AS_HANDLES
-extern FILE *          my_fdopen(int, char *);
-#endif
 extern int             my_fclose(FILE *);
 extern char *          win32_get_privlib(const char *pl, STRLEN *const len);
 extern char *          win32_get_sitelib(const char *pl, STRLEN *const len);
@@ -377,9 +370,7 @@ struct thread_intern {
     char               Wstrerror_buffer[512];
     struct servent     Wservent;
     char               Wgetlogin_buffer[128];
-#    ifdef USE_SOCKETS_AS_HANDLES
     int                        Winit_socktype;
-#    endif
     char               Wcrypt_buffer[30];
 #    ifdef USE_RTL_THREAD_API
     void *             retv;   /* slot for thread return value */
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 4ceb03c..479d99e 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -29,13 +29,8 @@
 #include <io.h>
 
 /* thanks to Beverly Brown     ([email protected]) */
-#ifdef USE_SOCKETS_AS_HANDLES
-#      define OPEN_SOCKET(x)   win32_open_osfhandle(x,O_RDWR|O_BINARY)
-#      define TO_SOCKET(x)     _get_osfhandle(x)
-#else
-#      define OPEN_SOCKET(x)   (x)
-#      define TO_SOCKET(x)     (x)
-#endif /* USE_SOCKETS_AS_HANDLES */
+#define OPEN_SOCKET(x) win32_open_osfhandle(x,O_RDWR|O_BINARY)
+#define TO_SOCKET(x)   _get_osfhandle(x)
 
 #define StartSockets() \
     STMT_START {                                       \
@@ -87,44 +82,6 @@ start_sockets(void)
     wsock_started = 1;
 }
 
-#ifndef USE_SOCKETS_AS_HANDLES
-#undef fdopen
-FILE *
-my_fdopen(int fd, char *mode)
-{
-    FILE *fp;
-    char sockbuf[256];
-    int optlen = sizeof(sockbuf);
-    int retval;
-
-    if (!wsock_started)
-       return(fdopen(fd, mode));
-
-    retval = getsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, sockbuf, &optlen);
-    if(retval == SOCKET_ERROR && WSAGetLastError() == WSAENOTSOCK) {
-       return(fdopen(fd, mode));
-    }
-
-    /*
-     * If we get here, then fd is actually a socket.
-     */
-    Newxz(fp, 1, FILE);        /* XXX leak, good thing this code isn't used */
-    if(fp == NULL) {
-       errno = ENOMEM;
-       return NULL;
-    }
-
-    fp->_file = fd;
-    if(*mode == 'r')
-       fp->_flag = _IOREAD;
-    else
-       fp->_flag = _IOWRT;
-   
-    return fp;
-}
-#endif /* USE_SOCKETS_AS_HANDLES */
-
-
 u_long
 win32_htonl(u_long hostlong)
 {
@@ -258,7 +215,6 @@ int
 win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, 
const struct timeval* timeout)
 {
     int r;
-#ifdef USE_SOCKETS_AS_HANDLES
     int i, fd, save_errno = errno;
     FD_SET nrd, nwr, nex;
     bool just_sleep = TRUE;
@@ -320,9 +276,6 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, 
Perl_fd_set* ex, const
        }
     }
     errno = save_errno;
-#else
-    SOCKET_TEST_ERROR(r = select(nfds, rd, wr, ex, timeout));
-#endif
     return r;
 }
 
@@ -372,9 +325,6 @@ win32_closesocket(SOCKET s)
     return r;
 }
 
-#ifdef USE_SOCKETS_AS_HANDLES
-#define WIN32_OPEN_SOCKET(af, type, protocol) open_ifs_socket(af, type, 
protocol)
-
 void
 convert_proto_info_w2a(WSAPROTOCOL_INFOW *in, WSAPROTOCOL_INFOA *out)
 {
@@ -433,25 +383,17 @@ open_ifs_socket(int af, int type, int protocol)
     return out;
 }
 
-#else
-#define WIN32_OPEN_SOCKET(af, type, protocol) socket(af, type, protocol)
-#endif
-
 SOCKET
 win32_socket(int af, int type, int protocol)
 {
     SOCKET s;
 
-#ifndef USE_SOCKETS_AS_HANDLES
-    SOCKET_TEST(s = socket(af, type, protocol), INVALID_SOCKET);
-#else
     StartSockets();
 
-    if((s = WIN32_OPEN_SOCKET(af, type, protocol)) == INVALID_SOCKET)
+    if((s = open_ifs_socket(af, type, protocol)) == INVALID_SOCKET)
        errno = WSAGetLastError();
     else
        s = OPEN_SOCKET(s);
-#endif /* USE_SOCKETS_AS_HANDLES */
 
     return s;
 }

--
Perl5 Master Repository

Reply via email to