Skip to content
Tcl Source Code Artifact [7c985385e0]
Login

Artifact [7c985385e0]

Artifact 7c985385e0d2b101aaa2fafede38e78c9af01886:

Attachment "tcl-unixchan-tls.patch" to ticket [727786ffff] added by jenglish on 2003-04-26 05:17:41.
Index: unix/tclUnixChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixChan.c,v
retrieving revision 1.42
diff -u -r1.42 tclUnixChan.c
--- unix/tclUnixChan.c	21 Feb 2003 02:36:27 -0000	1.42
+++ unix/tclUnixChan.c	25 Apr 2003 22:11:22 -0000
@@ -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:
@@ -1829,12 +1805,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;
 
@@ -1886,9 +1856,6 @@
     char channelName[16 + TCL_INTEGER_SPACE];
     int fd = (int) handle;
     Tcl_ChannelType *channelTypePtr;
-#ifdef DEPRECATED
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-#endif /* DEPRECATED */
     int socketType = 0;
     socklen_t argLength = sizeof(int);
 
@@ -1896,21 +1863,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 */
-
 #ifdef SUPPORTS_TTY
     if (isatty(fd)) {
 	fsPtr = TtyInit(fd, 0);
@@ -1927,12 +1879,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,
@@ -3290,37 +3236,7 @@
                                          * 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 */
+    /* no-op */
 }
 
 /*
@@ -3346,17 +3262,5 @@
                                          * 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 */
+    /* no-op */
 }