Tcl Source Code

Check-in [02368db2ae]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:better solution for bug-510001 it fills a correctly working stub entry for Win64
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-510001
Files: files | file ages | folders
SHA1: 02368db2ae8f7425c1d0a90974793224576b896f
User & Date: jan.nijtmans 2012-03-29 12:13:42
Context
2012-04-04
08:36
[Bug 510001]: TclSockMinimumBuffers needs plat imp check-in: cbf7dc0a31 user: jan.nijtmans tags: core-8-4-branch
2012-03-29
12:13
better solution for bug-510001 it fills a correctly working stub entry for Win64 Closed-Leaf check-in: 02368db2ae user: jan.nijtmans tags: bug-510001
2012-03-27
11:20
[Bug 3508771] Wrong Tcl_StatBuf used on MinGW [Bug 2015723] duplicate inodes from file stat on windo... check-in: 90c31690eb user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIOSock.c.

79
80
81
82
83
84
85





86
87



88

89
90
91
92
93
94
95
 *
 * Side effects:
 *	Sets SO_SNDBUF and SO_RCVBUF sizes.
 *
 *----------------------------------------------------------------------
 */






int
TclSockMinimumBuffers(sock, size)



    int 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);







>
>
>
>
>


>
>
>

>







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 *
 * Side effects:
 *	Sets SO_SNDBUF and SO_RCVBUF sizes.
 *
 *----------------------------------------------------------------------
 */

#ifdef _WIN64
    /* See bug 510001: TclSockMinimumBuffers needs plat imp */
#   define TclSockMinimumBuffers TclSockMinimumBuffersWin64
#endif

int
TclSockMinimumBuffers(sock, size)
#ifdef _WIN64
    SOCKET sock;		/* Socket file descriptor */
#else
    int sock;			/* Socket file descriptor */
#endif
    int size;			/* Minimum buffer size */
{
    int current;
    socklen_t len;

    len = sizeof(int);
    getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&current, &len);

Changes to generic/tclIntDecls.h.

1404
1405
1406
1407
1408
1409
1410













1411
1412
#define TclMatchIsTrivial \
	(tclIntStubsPtr->tclMatchIsTrivial) /* 199 */
#endif

#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */

/* !END!: Do not edit above this line. */














#endif /* _TCLINTDECLS */







>
>
>
>
>
>
>
>
>
>
>
>
>


1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
#define TclMatchIsTrivial \
	(tclIntStubsPtr->tclMatchIsTrivial) /* 199 */
#endif

#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */

/* !END!: Do not edit above this line. */

#ifdef _WIN64
    /* See bug 510001: TclSockMinimumBuffers needs plat imp */
    extern int TclSockMinimumBuffersWin64(unsigned __int64,int);

#   ifdef USE_TCL_STUBS
#	undef TclSockMinimumBuffers
#	define TclSockMinimumBuffers ((int (*)(SOCKET,int)) \
	    tclIntStubsPtr->tclSockMinimumBuffers)
#   else
#	define TclSockMinimumBuffers TclSockMinimumBuffersWin64
#   endif
#endif

#endif /* _TCLINTDECLS */

Changes to generic/tclStubInit.c.

50
51
52
53
54
55
56







57
58
59
60
61
62
63
    NULL,
#endif
    NULL,
    NULL,
    NULL,
    NULL
};








#ifdef __CYGWIN__

#define TclWinGetPlatformId winGetPlatformId
#define Tcl_WinUtfToTChar winUtfToTChar
#define Tcl_WinTCharToUtf winTCharToUtf
#define TclWinGetTclInstance winGetTclInstance







>
>
>
>
>
>
>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    NULL,
#endif
    NULL,
    NULL,
    NULL,
    NULL
};

#ifdef _WIN64
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
#   undef TclSockMinimumBuffers
#   define TclSockMinimumBuffers ((int (*)(int, int)) \
	    TclSockMinimumBuffersWin64)
#endif

#ifdef __CYGWIN__

#define TclWinGetPlatformId winGetPlatformId
#define Tcl_WinUtfToTChar winUtfToTChar
#define Tcl_WinTCharToUtf winTCharToUtf
#define TclWinGetTclInstance winGetTclInstance

Changes to win/tclWinSock.c.

1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166

    SetHandleInformation( (HANDLE) sock, HANDLE_FLAG_INHERIT, 0 );
	
    /*
     * Set kernel space buffering
     */

    TclSockMinimumBuffers((int) sock, TCP_BUFFER_SIZE);

    if (server) {
	/*
	 * Bind to the specified port.  Note that we must not call setsockopt
	 * with SO_REUSEADDR because Microsoft allows addresses to be reused
	 * even if they are still in use.
         *







|







1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166

    SetHandleInformation( (HANDLE) sock, HANDLE_FLAG_INHERIT, 0 );
	
    /*
     * Set kernel space buffering
     */

    TclSockMinimumBuffers(sock, TCP_BUFFER_SIZE);

    if (server) {
	/*
	 * Bind to the specified port.  Note that we must not call setsockopt
	 * with SO_REUSEADDR because Microsoft allows addresses to be reused
	 * even if they are still in use.
         *
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527

    tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);

    /*
     * Set kernel space buffering and non-blocking.
     */

    TclSockMinimumBuffers((int) sock, TCP_BUFFER_SIZE);

    infoPtr = NewSocketInfo((SOCKET) sock);

    /*
     * Start watching for read/write events on the socket.
     */








|







1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527

    tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);

    /*
     * Set kernel space buffering and non-blocking.
     */

    TclSockMinimumBuffers((SOCKET) sock, TCP_BUFFER_SIZE);

    infoPtr = NewSocketInfo((SOCKET) sock);

    /*
     * Start watching for read/write events on the socket.
     */