diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tclIOSock.c | 17 | ||||
-rw-r--r-- | generic/tclInt.decls | 5 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 16 | ||||
-rw-r--r-- | generic/tclStubInit.c | 17 | ||||
-rw-r--r-- | win/tclWinSock.c | 20 |
6 files changed, 50 insertions, 33 deletions
@@ -1,3 +1,11 @@ +2012-04-04 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tclWinSock.c: [Bug 510001]: TclSockMinimumBuffers needs plat imp + * generic/tclIOSock.c: + * generic/tclInt.decls: + * generic/tclIntDecls.h: + * generic/tclStubInit.c: + 2012-04-03 Jan Nijtmans <nijtmans@users.sf.net> * generic/tclStubInit.c Remove the TclpGetTZName implementation for diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 768428f..391939c 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -87,30 +87,29 @@ TclSockGetPort( *---------------------------------------------------------------------- */ -#ifdef _WIN32 -# define PTR2SOCK(a) (SOCKET)a -#else -# define PTR2SOCK(a) PTR2INT(a) +#ifndef _WIN32 +# define SOCKET int #endif + int TclSockMinimumBuffers( - ClientData sock, /* Socket file descriptor */ + void *sock, /* Socket file descriptor */ int size) /* Minimum buffer size */ { int current; socklen_t len; len = sizeof(int); - getsockopt(PTR2SOCK(sock), SOL_SOCKET, SO_SNDBUF, (char *)¤t, &len); + getsockopt((SOCKET)sock, SOL_SOCKET, SO_SNDBUF, (char *)¤t, &len); if (current < size) { len = sizeof(int); - setsockopt(PTR2SOCK(sock), SOL_SOCKET, SO_SNDBUF, (char *)&size, len); + setsockopt((SOCKET)sock, SOL_SOCKET, SO_SNDBUF, (char *)&size, len); } len = sizeof(int); - getsockopt(PTR2SOCK(sock), SOL_SOCKET, SO_RCVBUF, (char *)¤t, &len); + getsockopt((SOCKET)sock, SOL_SOCKET, SO_RCVBUF, (char *)¤t, &len); if (current < size) { len = sizeof(int); - setsockopt(PTR2SOCK(sock), SOL_SOCKET, SO_RCVBUF, (char *)&size, len); + setsockopt((SOCKET)sock, SOL_SOCKET, SO_RCVBUF, (char *)&size, len); } return TCL_OK; } diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 0c66c91..6808265 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -420,7 +420,10 @@ declare 103 { int *portPtr) } declare 104 { - int TclSockMinimumBuffers(ClientData sock, int size) + int TclSockMinimumBuffersOld(int sock, int size) +} +declare 110 { + int TclSockMinimumBuffers(void *sock, int size) } # Replaced by Tcl_FSStat in 8.4: #declare 105 { diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index b294e4f..1dbf10c 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -263,7 +263,7 @@ EXTERN void TclSetupEnv(Tcl_Interp *interp); EXTERN int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 104 */ -EXTERN int TclSockMinimumBuffers(ClientData sock, int size); +EXTERN int TclSockMinimumBuffersOld(int sock, int size); /* Slot 105 is reserved */ /* Slot 106 is reserved */ /* Slot 107 is reserved */ @@ -271,7 +271,8 @@ EXTERN int TclSockMinimumBuffers(ClientData sock, int size); EXTERN void TclTeardownNamespace(Namespace *nsPtr); /* 109 */ EXTERN int TclUpdateReturnInfo(Interp *iPtr); -/* Slot 110 is reserved */ +/* 110 */ +EXTERN int TclSockMinimumBuffers(void *sock, int size); /* 111 */ EXTERN void Tcl_AddInterpResolvers(Tcl_Interp *interp, const char *name, @@ -710,13 +711,13 @@ typedef struct TclIntStubs { CONST86 char * (*tclSetPreInitScript) (const char *string); /* 101 */ void (*tclSetupEnv) (Tcl_Interp *interp); /* 102 */ int (*tclSockGetPort) (Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 103 */ - int (*tclSockMinimumBuffers) (ClientData sock, int size); /* 104 */ + int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */ void (*reserved105)(void); void (*reserved106)(void); void (*reserved107)(void); void (*tclTeardownNamespace) (Namespace *nsPtr); /* 108 */ int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */ - void (*reserved110)(void); + int (*tclSockMinimumBuffers) (void *sock, int size); /* 110 */ void (*tcl_AddInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 111 */ int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */ Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */ @@ -1034,8 +1035,8 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSetupEnv) /* 102 */ #define TclSockGetPort \ (tclIntStubsPtr->tclSockGetPort) /* 103 */ -#define TclSockMinimumBuffers \ - (tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */ +#define TclSockMinimumBuffersOld \ + (tclIntStubsPtr->tclSockMinimumBuffersOld) /* 104 */ /* Slot 105 is reserved */ /* Slot 106 is reserved */ /* Slot 107 is reserved */ @@ -1043,7 +1044,8 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclTeardownNamespace) /* 108 */ #define TclUpdateReturnInfo \ (tclIntStubsPtr->tclUpdateReturnInfo) /* 109 */ -/* Slot 110 is reserved */ +#define TclSockMinimumBuffers \ + (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ #define Tcl_AddInterpResolvers \ (tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */ #define Tcl_AppendExportList \ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index e032874..084a77c 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -40,6 +40,19 @@ #undef Tcl_Panic #undef Tcl_FindExecutable +/* See bug 510001: TclSockMinimumBuffers needs plat imp */ +#ifdef _WIN64 +# define TclSockMinimumBuffersOld 0 +#else +#define TclSockMinimumBuffersOld sockMinimumBuffersOld +static int TclSockMinimumBuffersOld(sock, size) + int sock; + int size; +{ + return TclSockMinimumBuffers(INT2PTR(sock), size); +} +#endif + #ifdef __CYGWIN__ /* Trick, so we don't have to include <windows.h> here, which @@ -289,13 +302,13 @@ static const TclIntStubs tclIntStubs = { TclSetPreInitScript, /* 101 */ TclSetupEnv, /* 102 */ TclSockGetPort, /* 103 */ - TclSockMinimumBuffers, /* 104 */ + TclSockMinimumBuffersOld, /* 104 */ 0, /* 105 */ 0, /* 106 */ 0, /* 107 */ TclTeardownNamespace, /* 108 */ TclUpdateReturnInfo, /* 109 */ - 0, /* 110 */ + TclSockMinimumBuffers, /* 110 */ Tcl_AddInterpResolvers, /* 111 */ Tcl_AppendExportList, /* 112 */ Tcl_CreateNamespace, /* 113 */ diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 74c7245..cbaedcb 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1056,7 +1056,7 @@ CreateSocket( * Set kernel space buffering */ - TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); + TclSockMinimumBuffers((void *)sock, TCP_BUFFER_SIZE); /* * Make sure we use the same port when opening two server sockets @@ -1165,7 +1165,7 @@ CreateSocket( * Set kernel space buffering */ - TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); + TclSockMinimumBuffers((void *)sock, TCP_BUFFER_SIZE); /* * Try to bind to a local port. @@ -1501,7 +1501,7 @@ Tcl_MakeTcpClientChannel( * Set kernel space buffering and non-blocking. */ - TclSockMinimumBuffers((ClientData) sock, TCP_BUFFER_SIZE); + TclSockMinimumBuffers(sock, TCP_BUFFER_SIZE); infoPtr = NewSocketInfo((SOCKET) sock); @@ -2673,12 +2673,8 @@ InitializeHostName( */ int -TclWinGetSockOpt( - SOCKET s, - int level, - int optname, - char * optval, - int FAR *optlen) +TclWinGetSockOpt(SOCKET s, int level, int optname, char *optval, + int *optlen) { /* * Check that WinSock is initialized; do not call it if not, to prevent @@ -2694,11 +2690,7 @@ TclWinGetSockOpt( } int -TclWinSetSockOpt( - SOCKET s, - int level, - int optname, - const char * optval, +TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, int optlen) { /* |