Attachment "tcl-unixchan-tls.patch" to
ticket [727786ffff]
added by
jenglish
2003-11-25 09:13:01.
--- unix/tclUnixChan.c.unixchan-tls.old 2003-11-24 18:15:54.000000000 -0800
+++ unix/tclUnixChan.c 2003-11-24 18:19:46.000000000 -0800
@@ -127,10 +127,6 @@
int validMask; /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, or TCL_EXCEPTION: indicates
* which operations are valid on the file. */
-#ifdef DEPRECATED
- struct FileState *nextPtr; /* Pointer to next file in list of all
- * file channels. */
-#endif /* DEPRECATED */
} FileState;
#ifdef SUPPORTS_TTY
@@ -169,19 +165,6 @@
" not supported for this platform", (char *) NULL); \
}
-#ifdef DEPRECATED
-typedef struct ThreadSpecificData {
- /*
- * List of all file channels currently open. This is per thread and is
- * used to match up fd's to channels, which rarely occurs.
- */
-
- FileState *firstFilePtr;
-} ThreadSpecificData;
-
-static Tcl_ThreadDataKey dataKey;
-#endif /* DEPRECATED */
-
/*
* This structure describes per-instance state of a tcp based channel.
*/
@@ -544,10 +527,6 @@
{
FileState *fsPtr = (FileState *) instanceData;
int errorCode = 0;
-#ifdef DEPRECATED
- FileState **nextPtrPtr;
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-#endif /* DEPRECATED */
Tcl_DeleteFileHandler(fsPtr->fd);
/*
@@ -1759,9 +1738,6 @@
#ifdef SUPPORTS_TTY
int ctl_tty;
#endif /* SUPPORTS_TTY */
-#ifdef DEPRECATED
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-#endif /* DEPRECATED */
switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) {
case O_RDONLY:
@@ -1832,12 +1808,6 @@
fsPtr = (FileState *) ckalloc((unsigned) sizeof(FileState));
}
-#ifdef DEPRECATED
- if (channelTypePtr == &fileChannelType) {
- fsPtr->nextPtr = tsdPtr->firstFilePtr;
- tsdPtr->firstFilePtr = fsPtr;
- }
-#endif /* DEPRECATED */
fsPtr->validMask = channelPermissions | TCL_EXCEPTION;
fsPtr->fd = fd;
@@ -1889,9 +1859,6 @@
char channelName[16 + TCL_INTEGER_SPACE];
int fd = (int) handle;
Tcl_ChannelType *channelTypePtr;
-#ifdef DEPRECATED
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-#endif /* DEPRECATED */
struct sockaddr sockaddr;
socklen_t sockaddrLen = sizeof(sockaddr);
@@ -1899,21 +1866,6 @@
return NULL;
}
-
- /*
- * Look to see if a channel with this fd and the same mode already exists.
- * If the fd is used, but the mode doesn't match, return NULL.
- */
-
-#ifdef DEPRECATED
- for (fsPtr = tsdPtr->firstFilePtr; fsPtr != NULL; fsPtr = fsPtr->nextPtr) {
- if (fsPtr->fd == fd) {
- return ((mode|TCL_EXCEPTION) == fsPtr->validMask) ?
- fsPtr->channel : NULL;
- }
- }
-#endif /* DEPRECATED */
-
sockaddr.sa_family = AF_UNSPEC;
#ifdef SUPPORTS_TTY
@@ -1933,12 +1885,6 @@
sprintf(channelName, "file%d", fd);
}
-#ifdef DEPRECATED
- if (channelTypePtr == &fileChannelType) {
- fsPtr->nextPtr = tsdPtr->firstFilePtr;
- tsdPtr->firstFilePtr = fsPtr;
- }
-#endif /* DEPRECATED */
fsPtr->fd = fd;
fsPtr->validMask = mode | TCL_EXCEPTION;
fsPtr->channel = Tcl_CreateChannel(channelTypePtr, channelName,
@@ -3285,7 +3231,7 @@
* None.
*
* Side effects:
- * Changes thread local list of valid channels.
+ * None. This is a no-op under Unix.
*
*----------------------------------------------------------------------
*/
@@ -3296,37 +3242,6 @@
* not be referenced in any
* interpreter. */
{
-#ifdef DEPRECATED
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- Channel *chanPtr = (Channel *) chan;
- FileState *fsPtr;
- FileState **nextPtrPtr;
- int removed = 0;
-
- if (chanPtr->typePtr != &fileChannelType)
- return;
-
- fsPtr = (FileState *) chanPtr->instanceData;
-
- for (nextPtrPtr = &(tsdPtr->firstFilePtr); (*nextPtrPtr) != NULL;
- nextPtrPtr = &((*nextPtrPtr)->nextPtr)) {
- if ((*nextPtrPtr) == fsPtr) {
- (*nextPtrPtr) = fsPtr->nextPtr;
- removed = 1;
- break;
- }
- }
-
- /*
- * This could happen if the channel was created in one thread
- * and then moved to another without updating the thread
- * local data in each thread.
- */
-
- if (!removed)
- panic("file info ptr not on thread channel list");
-
-#endif /* DEPRECATED */
}
/*
@@ -3341,7 +3256,7 @@
* None.
*
* Side effects:
- * Changes thread local list of valid channels.
+ * None. This is a no-op under Unix.
*
*----------------------------------------------------------------------
*/
@@ -3352,17 +3267,4 @@
* not be referenced in any
* interpreter. */
{
-#ifdef DEPRECATED
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- Channel *chanPtr = (Channel *) chan;
- FileState *fsPtr;
-
- if (chanPtr->typePtr != &fileChannelType)
- return;
-
- fsPtr = (FileState *) chanPtr->instanceData;
-
- fsPtr->nextPtr = tsdPtr->firstFilePtr;
- tsdPtr->firstFilePtr = fsPtr;
-#endif /* DEPRECATED */
}