summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-04 09:05:51 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-04 09:05:51 (GMT)
commit10d62422b2a9cd29828f3d750f8253076ba0cf3f (patch)
tree65cab1f3b3d6a018af1926ded98137478d1bd3c1 /generic
parent60cfc1cbac7cd027431546b2a5d260d25ee1a502 (diff)
parent5cc8272056a2950e552b579f4717b123a9578bdc (diff)
downloadtcl-10d62422b2a9cd29828f3d750f8253076ba0cf3f.zip
tcl-10d62422b2a9cd29828f3d750f8253076ba0cf3f.tar.gz
tcl-10d62422b2a9cd29828f3d750f8253076ba0cf3f.tar.bz2
[Bug 510001]: TclSockMinimumBuffers needs plat imp
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOSock.c15
-rw-r--r--generic/tclInt.decls5
-rw-r--r--generic/tclIntDecls.h71
-rw-r--r--generic/tclStubInit.c24
4 files changed, 97 insertions, 18 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c
index ec4a9d9..7233646 100644
--- a/generic/tclIOSock.c
+++ b/generic/tclIOSock.c
@@ -81,25 +81,30 @@ TclSockGetPort(
*----------------------------------------------------------------------
*/
+#undef TclSockMinimumBuffers
+#ifndef _WIN32
+# define SOCKET int
+#endif
+
int
TclSockMinimumBuffers(
- 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 *)&current, &len);
+ getsockopt((SOCKET)sock, SOL_SOCKET, SO_SNDBUF, (char *)&current, &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 *)&current, &len);
+ getsockopt((SOCKET)sock, SOL_SOCKET, SO_RCVBUF, (char *)&current, &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 71615ec..ac2d84b 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -419,7 +419,10 @@ declare 103 {
int *portPtr)
}
declare 104 {
- 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 fb63ec0..6be7f94 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -438,10 +438,10 @@ EXTERN void TclSetupEnv(Tcl_Interp *interp);
EXTERN int TclSockGetPort(Tcl_Interp *interp, CONST char *str,
CONST char *proto, int *portPtr);
#endif
-#ifndef TclSockMinimumBuffers_TCL_DECLARED
-#define TclSockMinimumBuffers_TCL_DECLARED
+#ifndef TclSockMinimumBuffersOld_TCL_DECLARED
+#define TclSockMinimumBuffersOld_TCL_DECLARED
/* 104 */
-EXTERN int TclSockMinimumBuffers(int sock, int size);
+EXTERN int TclSockMinimumBuffersOld(int sock, int size);
#endif
/* Slot 105 is reserved */
/* Slot 106 is reserved */
@@ -456,7 +456,27 @@ EXTERN void TclTeardownNamespace(Namespace *nsPtr);
/* 109 */
EXTERN int TclUpdateReturnInfo(Interp *iPtr);
#endif
-/* Slot 110 is reserved */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#ifndef TclSockMinimumBuffers_TCL_DECLARED
+#define TclSockMinimumBuffers_TCL_DECLARED
+/* 110 */
+EXTERN int TclSockMinimumBuffers(VOID *sock, int size);
+#endif
+#endif /* UNIX */
+#ifdef __WIN32__ /* WIN */
+#ifndef TclSockMinimumBuffers_TCL_DECLARED
+#define TclSockMinimumBuffers_TCL_DECLARED
+/* 110 */
+EXTERN int TclSockMinimumBuffers(VOID *sock, int size);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclSockMinimumBuffers_TCL_DECLARED
+#define TclSockMinimumBuffers_TCL_DECLARED
+/* 110 */
+EXTERN int TclSockMinimumBuffers(VOID *sock, int size);
+#endif
+#endif /* MACOSX */
#ifndef Tcl_AddInterpResolvers_TCL_DECLARED
#define Tcl_AddInterpResolvers_TCL_DECLARED
/* 111 */
@@ -1158,13 +1178,21 @@ typedef struct TclIntStubs {
char * (*tclSetPreInitScript) (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) (int sock, int size); /* 104 */
+ int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */
VOID *reserved105;
VOID *reserved106;
VOID *reserved107;
void (*tclTeardownNamespace) (Namespace *nsPtr); /* 108 */
int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */
- VOID *reserved110;
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */
+#endif /* UNIX */
+#ifdef __WIN32__ /* WIN */
+ int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */
+#endif /* MACOSX */
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 */
@@ -1598,9 +1626,9 @@ extern TclIntStubs *tclIntStubsPtr;
#define TclSockGetPort \
(tclIntStubsPtr->tclSockGetPort) /* 103 */
#endif
-#ifndef TclSockMinimumBuffers
-#define TclSockMinimumBuffers \
- (tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */
+#ifndef TclSockMinimumBuffersOld
+#define TclSockMinimumBuffersOld \
+ (tclIntStubsPtr->tclSockMinimumBuffersOld) /* 104 */
#endif
/* Slot 105 is reserved */
/* Slot 106 is reserved */
@@ -1613,7 +1641,24 @@ extern TclIntStubs *tclIntStubsPtr;
#define TclUpdateReturnInfo \
(tclIntStubsPtr->tclUpdateReturnInfo) /* 109 */
#endif
-/* Slot 110 is reserved */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#ifndef TclSockMinimumBuffers
+#define TclSockMinimumBuffers \
+ (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */
+#endif
+#endif /* UNIX */
+#ifdef __WIN32__ /* WIN */
+#ifndef TclSockMinimumBuffers
+#define TclSockMinimumBuffers \
+ (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclSockMinimumBuffers
+#define TclSockMinimumBuffers \
+ (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */
+#endif
+#endif /* MACOSX */
#ifndef Tcl_AddInterpResolvers
#define Tcl_AddInterpResolvers \
(tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */
@@ -2037,6 +2082,12 @@ 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(PTR2INT(a),b)
+#endif
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 4c70f00..dfdc79a 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
+
MODULE_SCOPE TclIntStubs tclIntStubs;
MODULE_SCOPE TclIntPlatStubs tclIntPlatStubs;
MODULE_SCOPE TclPlatStubs tclPlatStubs;
@@ -306,13 +318,21 @@ TclIntStubs tclIntStubs = {
TclSetPreInitScript, /* 101 */
TclSetupEnv, /* 102 */
TclSockGetPort, /* 103 */
- TclSockMinimumBuffers, /* 104 */
+ TclSockMinimumBuffersOld, /* 104 */
NULL, /* 105 */
NULL, /* 106 */
NULL, /* 107 */
TclTeardownNamespace, /* 108 */
TclUpdateReturnInfo, /* 109 */
- NULL, /* 110 */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ TclSockMinimumBuffers, /* 110 */
+#endif /* UNIX */
+#ifdef __WIN32__ /* WIN */
+ TclSockMinimumBuffers, /* 110 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TclSockMinimumBuffers, /* 110 */
+#endif /* MACOSX */
Tcl_AddInterpResolvers, /* 111 */
Tcl_AppendExportList, /* 112 */
Tcl_CreateNamespace, /* 113 */