summaryrefslogtreecommitdiff
path: root/win32/win32sck.c
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2012-09-28 09:02:31 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2012-09-28 09:02:31 +0100
commit72e6b643d040f276d474b709b942bdd8d03bc2a2 (patch)
tree096cc06b9d44a8ea65dcfc6d898fa1af23fb2aaf /win32/win32sck.c
parent1af70165a5e66fcde5decf8b027291ef927e4b2b (diff)
downloadperl-72e6b643d040f276d474b709b942bdd8d03bc2a2.tar.gz
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.
Diffstat (limited to 'win32/win32sck.c')
-rw-r--r--win32/win32sck.c64
1 files changed, 3 insertions, 61 deletions
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 4ceb03c443..479d99ea53 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -29,13 +29,8 @@
#include <io.h>
/* thanks to Beverly Brown (beverly@datacube.com) */
-#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;
}