diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tclIOSock.c | 15 | ||||
-rw-r--r-- | generic/tclInt.decls | 5 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 58 | ||||
-rw-r--r-- | generic/tclStubInit.c | 24 | ||||
-rw-r--r-- | win/tclWinSock.c | 6 |
6 files changed, 93 insertions, 23 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/ttclStubInit.c: + 2012-04-03 Jan Nijtmans <nijtmans@users.sf.net> * tools/genStubs.tcl: Let genStubs.tcl do the void -> VOID and diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index f311912..159f3da 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -83,25 +83,30 @@ TclSockGetPort(interp, string, proto, portPtr) *---------------------------------------------------------------------- */ +#undef TclSockMinimumBuffers +#ifndef _WIN32 +# define SOCKET int +#endif + int TclSockMinimumBuffers(sock, size) - int sock; /* Socket file descriptor */ + void *sock; /* Socket file descriptor */ int size; /* Minimum buffer size */ { int current; socklen_t len; len = sizeof(int); - getsockopt(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(sock, SOL_SOCKET, SO_SNDBUF, (char *)&size, len); + setsockopt((SOCKET)sock, SOL_SOCKET, SO_SNDBUF, (char *)&size, len); } len = sizeof(int); - getsockopt(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(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 43947df..d380270 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -408,7 +408,10 @@ declare 103 { int *portPtr) } declare 104 {unix win} { - int TclSockMinimumBuffers(int sock, int size) + int TclSockMinimumBuffersOld(int sock, int size) +} +declare 110 {unix win} { + 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 bf0c2b7..94860aa 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -291,12 +291,12 @@ EXTERN int TclSockGetPort _ANSI_ARGS_((Tcl_Interp *interp, char *str, char *proto, int *portPtr)); #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ /* 104 */ -EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((int sock, +EXTERN int TclSockMinimumBuffersOld _ANSI_ARGS_((int sock, int size)); #endif /* UNIX */ #ifdef __WIN32__ /* 104 */ -EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((int sock, +EXTERN int TclSockMinimumBuffersOld _ANSI_ARGS_((int sock, int size)); #endif /* __WIN32__ */ /* Slot 105 is reserved */ @@ -308,7 +308,16 @@ EXTERN int TclStatInsertProc _ANSI_ARGS_((TclStatProc_ *proc)); EXTERN void TclTeardownNamespace _ANSI_ARGS_((Namespace *nsPtr)); /* 109 */ EXTERN int TclUpdateReturnInfo _ANSI_ARGS_((Interp *iPtr)); -/* Slot 110 is reserved */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +/* 110 */ +EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((VOID *sock, + int size)); +#endif /* UNIX */ +#ifdef __WIN32__ +/* 110 */ +EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((VOID *sock, + int size)); +#endif /* __WIN32__ */ /* 111 */ EXTERN void Tcl_AddInterpResolvers _ANSI_ARGS_(( Tcl_Interp *interp, CONST char *name, @@ -653,10 +662,10 @@ typedef struct TclIntStubs { void (*tclSetupEnv) _ANSI_ARGS_((Tcl_Interp *interp)); /* 102 */ int (*tclSockGetPort) _ANSI_ARGS_((Tcl_Interp *interp, char *str, char *proto, int *portPtr)); /* 103 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - int (*tclSockMinimumBuffers) _ANSI_ARGS_((int sock, int size)); /* 104 */ + int (*tclSockMinimumBuffersOld) _ANSI_ARGS_((int sock, int size)); /* 104 */ #endif /* UNIX */ #ifdef __WIN32__ - int (*tclSockMinimumBuffers) _ANSI_ARGS_((int sock, int size)); /* 104 */ + int (*tclSockMinimumBuffersOld) _ANSI_ARGS_((int sock, int size)); /* 104 */ #endif /* __WIN32__ */ #ifdef MAC_TCL VOID *reserved104; @@ -666,7 +675,15 @@ typedef struct TclIntStubs { int (*tclStatInsertProc) _ANSI_ARGS_((TclStatProc_ *proc)); /* 107 */ void (*tclTeardownNamespace) _ANSI_ARGS_((Namespace *nsPtr)); /* 108 */ int (*tclUpdateReturnInfo) _ANSI_ARGS_((Interp *iPtr)); /* 109 */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ + int (*tclSockMinimumBuffers) _ANSI_ARGS_((VOID *sock, int size)); /* 110 */ +#endif /* UNIX */ +#ifdef __WIN32__ + int (*tclSockMinimumBuffers) _ANSI_ARGS_((VOID *sock, int size)); /* 110 */ +#endif /* __WIN32__ */ +#ifdef MAC_TCL VOID *reserved110; +#endif /* MAC_TCL */ void (*tcl_AddInterpResolvers) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc)); /* 111 */ int (*tcl_AppendExportList) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr)); /* 112 */ Tcl_Namespace * (*tcl_CreateNamespace) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)); /* 113 */ @@ -1103,15 +1120,15 @@ extern TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSockGetPort) /* 103 */ #endif #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -#ifndef TclSockMinimumBuffers -#define TclSockMinimumBuffers \ - (tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */ +#ifndef TclSockMinimumBuffersOld +#define TclSockMinimumBuffersOld \ + (tclIntStubsPtr->tclSockMinimumBuffersOld) /* 104 */ #endif #endif /* UNIX */ #ifdef __WIN32__ -#ifndef TclSockMinimumBuffers -#define TclSockMinimumBuffers \ - (tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */ +#ifndef TclSockMinimumBuffersOld +#define TclSockMinimumBuffersOld \ + (tclIntStubsPtr->tclSockMinimumBuffersOld) /* 104 */ #endif #endif /* __WIN32__ */ /* Slot 105 is reserved */ @@ -1131,7 +1148,18 @@ extern TclIntStubs *tclIntStubsPtr; #define TclUpdateReturnInfo \ (tclIntStubsPtr->tclUpdateReturnInfo) /* 109 */ #endif -/* Slot 110 is reserved */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +#ifndef TclSockMinimumBuffers +#define TclSockMinimumBuffers \ + (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ +#endif +#endif /* UNIX */ +#ifdef __WIN32__ +#ifndef TclSockMinimumBuffers +#define TclSockMinimumBuffers \ + (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ +#endif +#endif /* __WIN32__ */ #ifndef Tcl_AddInterpResolvers #define Tcl_AddInterpResolvers \ (tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */ @@ -1406,4 +1434,10 @@ extern TclIntStubs *tclIntStubsPtr; /* !END!: Do not edit above this line. */ +#if !defined(_WIN64) +/* See bug 510001: TclSockMinimumBuffers needs plat imp */ +# undef TclSockMinimumBuffers +# define TclSockMinimumBuffers(a,b) TclSockMinimumBuffersOld((int)(a),b) +#endif + #endif /* _TCLINTDECLS */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 71470b3..cbb89a2 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -55,6 +55,18 @@ Tcl_NotifierProcs tclOriginalNotifier = { NULL }; +/* See bug 510001: TclSockMinimumBuffers needs plat imp */ +#ifdef _WIN64 +# define TclSockMinimumBuffersOld 0 +#else +int TclSockMinimumBuffersOld(sock, size) + int sock; + int size; +{ + return TclSockMinimumBuffers((void *) (size_t) sock, size); +} +#endif + #ifdef __CYGWIN__ /* Trick, so we don't have to include <windows.h> here, which @@ -317,10 +329,10 @@ TclIntStubs tclIntStubs = { TclSetupEnv, /* 102 */ TclSockGetPort, /* 103 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - TclSockMinimumBuffers, /* 104 */ + TclSockMinimumBuffersOld, /* 104 */ #endif /* UNIX */ #ifdef __WIN32__ - TclSockMinimumBuffers, /* 104 */ + TclSockMinimumBuffersOld, /* 104 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 104 */ @@ -330,7 +342,15 @@ TclIntStubs tclIntStubs = { TclStatInsertProc, /* 107 */ TclTeardownNamespace, /* 108 */ TclUpdateReturnInfo, /* 109 */ +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ + TclSockMinimumBuffers, /* 110 */ +#endif /* UNIX */ +#ifdef __WIN32__ + TclSockMinimumBuffers, /* 110 */ +#endif /* __WIN32__ */ +#ifdef MAC_TCL NULL, /* 110 */ +#endif /* MAC_TCL */ Tcl_AddInterpResolvers, /* 111 */ Tcl_AppendExportList, /* 112 */ Tcl_CreateNamespace, /* 113 */ diff --git a/win/tclWinSock.c b/win/tclWinSock.c index f3fe979..06d0590 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1156,7 +1156,7 @@ CreateSocket(interp, port, host, server, myaddr, myport, async) * Set kernel space buffering */ - TclSockMinimumBuffers((int) sock, TCP_BUFFER_SIZE); + TclSockMinimumBuffers((void *)sock, TCP_BUFFER_SIZE); if (server) { /* @@ -1517,7 +1517,7 @@ Tcl_MakeTcpClientChannel(sock) * Set kernel space buffering and non-blocking. */ - TclSockMinimumBuffers((int) sock, TCP_BUFFER_SIZE); + TclSockMinimumBuffers(sock, TCP_BUFFER_SIZE); infoPtr = NewSocketInfo((SOCKET) sock); @@ -2645,7 +2645,7 @@ Tcl_GetHostName() int TclWinGetSockOpt(SOCKET s, int level, int optname, char * optval, - int FAR *optlen) + int *optlen) { /* * Check that WinSock is initialized; do not call it if not, to |