diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-18 12:10:26 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-18 12:10:26 (GMT) |
| commit | 450b6f46c96b96bec44fb0bc119e3d11f3434f4a (patch) | |
| tree | 5f4ccb4d3df569fcd06e804ff1b5ebd8a72505bb /unix | |
| parent | 4d9fc11c2ffbcc95218111734c64397df0dfcf63 (diff) | |
| parent | edcac92c086fa48aff50db9763afecbed00c2a37 (diff) | |
| download | tcl-450b6f46c96b96bec44fb0bc119e3d11f3434f4a.zip tcl-450b6f46c96b96bec44fb0bc119e3d11f3434f4a.tar.gz tcl-450b6f46c96b96bec44fb0bc119e3d11f3434f4a.tar.bz2 | |
merge novem
Diffstat (limited to 'unix')
| -rw-r--r-- | unix/Makefile.in | 10 | ||||
| -rwxr-xr-x | unix/configure | 3 | ||||
| -rw-r--r-- | unix/configure.ac | 1 | ||||
| -rw-r--r-- | unix/dltest/pkgua.c | 4 | ||||
| -rw-r--r-- | unix/tclConfig.h.in | 3 | ||||
| -rw-r--r-- | unix/tclUnixCompat.c | 4 | ||||
| -rw-r--r-- | unix/tclUnixFCmd.c | 12 | ||||
| -rw-r--r-- | unix/tclUnixFile.c | 6 | ||||
| -rw-r--r-- | unix/tclUnixInit.c | 16 | ||||
| -rw-r--r-- | unix/tclUnixNotfy.c | 4 | ||||
| -rw-r--r-- | unix/tclUnixSock.c | 45 | ||||
| -rw-r--r-- | unix/tclUnixThrd.c | 10 |
12 files changed, 75 insertions, 43 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index 5d2128c..505f5d8 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.o bn_mp_copy.o \ bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \ bn_mp_div_2d.o bn_mp_div_3.o \ - bn_mp_exch.o bn_mp_expt_d.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_grow.o bn_mp_init.o \ bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -501,6 +501,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_div_3.c \ $(TOMMATH_DIR)/bn_mp_exch.c \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ + $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ $(TOMMATH_DIR)/bn_mp_init_copy.c \ @@ -838,8 +839,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ done; - @echo "Installing package http 2.8.9 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/http-2.8.9.tm; + @echo "Installing package http 2.8.10 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/http-2.8.10.tm; @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"; @for i in $(TOP_DIR)/library/opt/*.tcl ; \ do \ @@ -1418,6 +1419,9 @@ bn_mp_exch.o: $(TOMMATH_DIR)/bn_mp_exch.c $(MATHHDRS) bn_mp_expt_d.o: $(TOMMATH_DIR)/bn_mp_expt_d.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_d.c +bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_d_ex.c + bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c diff --git a/unix/configure b/unix/configure index ac9a91b..7c348f7 100755 --- a/unix/configure +++ b/unix/configure @@ -6857,9 +6857,6 @@ $as_echo "enabled $tcl_ok debugging" >&6; } -$as_echo "#define TCL_TOMMATH 1" >>confdefs.h - - $as_echo "#define MP_PREC 4" >>confdefs.h diff --git a/unix/configure.ac b/unix/configure.ac index 9def231..ad7b667 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -182,7 +182,6 @@ SC_CONFIG_CFLAGS SC_ENABLE_SYMBOLS(bccdebug) -AC_DEFINE(TCL_TOMMATH, 1, [Build libtommath?]) AC_DEFINE(MP_PREC, 4, [Default libtommath precision.]) #-------------------------------------------------------------------- diff --git a/unix/dltest/pkgua.c b/unix/dltest/pkgua.c index 272b6d1..1650bcc 100644 --- a/unix/dltest/pkgua.c +++ b/unix/dltest/pkgua.c @@ -69,7 +69,7 @@ PkguaInterpToTokens( int newEntry; Tcl_Command *cmdTokens; Tcl_HashEntry *entryPtr = - Tcl_CreateHashEntry(&interpTokenMap, (char *) interp, &newEntry); + Tcl_CreateHashEntry(&interpTokenMap, interp, &newEntry); if (newEntry) { cmdTokens = (Tcl_Command *) @@ -89,7 +89,7 @@ PkguaDeleteTokens( Tcl_Interp *interp) { Tcl_HashEntry *entryPtr = - Tcl_FindHashEntry(&interpTokenMap, (char *) interp); + Tcl_FindHashEntry(&interpTokenMap, interp); if (entryPtr) { Tcl_Free((char *) Tcl_GetHashValue(entryPtr)); diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index f5b9f07..c978f46 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -394,9 +394,6 @@ /* Are we building with threads enabled? */ #undef TCL_THREADS -/* Build libtommath? */ -#undef TCL_TOMMATH - /* Do we allow unloading of shared libraries? */ #undef TCL_UNLOAD_DLLS diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index e5929ba..ee00190 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -986,8 +986,8 @@ CopyString( int TclWinCPUID( - unsigned int index, /* Which CPUID value to retrieve. */ - unsigned int *regsPtr) /* Registers after the CPUID. */ + int index, /* Which CPUID value to retrieve. */ + int *regsPtr) /* Registers after the CPUID. */ { int status = TCL_ERROR; diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index bb67171..6aee70f 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1507,7 +1507,7 @@ SetGroupAttribute( const char *string; size_t length; - string = Tcl_GetString(attributePtr); + string = TclGetString(attributePtr); length = attributePtr->length; native = Tcl_UtfToExternalDString(NULL, string, length, &ds); @@ -1575,7 +1575,7 @@ SetOwnerAttribute( const char *string; size_t length; - string = Tcl_GetString(attributePtr); + string = TclGetString(attributePtr); length = attributePtr->length; native = Tcl_UtfToExternalDString(NULL, string, length, &ds); @@ -1948,7 +1948,7 @@ TclpObjNormalizePath( const char *currentPathEndPosition; size_t pathLen; char cur; - const char *path = Tcl_GetString(pathPtr); + const char *path = TclGetString(pathPtr); Tcl_DString ds; const char *nativePath; #ifndef NO_REALPATH @@ -2186,7 +2186,7 @@ TclUnixOpenTemporaryFile( */ if (dirObj) { - string = Tcl_GetString(dirObj); + string = TclGetString(dirObj); len = dirObj->length; Tcl_UtfToExternalDString(NULL, string, len, &template); } else { @@ -2197,7 +2197,7 @@ TclUnixOpenTemporaryFile( TclDStringAppendLiteral(&template, "/"); if (basenameObj) { - string = Tcl_GetString(basenameObj); + string = TclGetString(basenameObj); len = basenameObj->length; Tcl_UtfToExternalDString(NULL, string, len, &tmp); TclDStringAppendDString(&template, &tmp); @@ -2210,7 +2210,7 @@ TclUnixOpenTemporaryFile( #ifdef HAVE_MKSTEMPS if (extensionObj) { - string = Tcl_GetString(extensionObj); + string = TclGetString(extensionObj); len = extensionObj->length; Tcl_UtfToExternalDString(NULL, string, len, &tmp); TclDStringAppendDString(&template, &tmp); diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index d712bb9..9f77df2 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -269,7 +269,7 @@ TclpMatchInDirectory( Tcl_DString dsOrig; /* utf-8 encoding of dir */ Tcl_DStringInit(&dsOrig); - dirName = Tcl_GetString(fileNamePtr); + dirName = TclGetString(fileNamePtr); dirLength = fileNamePtr->length; Tcl_DStringAppend(&dsOrig, dirName, dirLength); @@ -952,7 +952,7 @@ TclpObjLink( if (transPtr == NULL) { return NULL; } - target = Tcl_GetString(transPtr); + target = TclGetString(transPtr); targetLen = transPtr->length; target = Tcl_UtfToExternalDString(NULL, target, targetLen, &ds); Tcl_DecrRefCount(transPtr); @@ -1107,7 +1107,7 @@ TclNativeCreateNativeRep( Tcl_IncrRefCount(validPathPtr); } - str = Tcl_GetString(validPathPtr); + str = TclGetString(validPathPtr); len = validPathPtr->length; Tcl_UtfToExternalDString(NULL, str, len, &ds); len = Tcl_DStringLength(&ds) + sizeof(char); diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 5a97369..50c543c 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -391,14 +391,6 @@ TclpInitPlatform(void) #endif /* SIGPIPE */ #if defined(__FreeBSD__) && defined(__GNUC__) - /* - * Adjust the rounding mode to be more conventional. Note that FreeBSD - * only provides the __fpsetreg() used by the following two for the GNU - * Compiler. When using, say, Intel's icc they break. (Partially based on - * patch in BSD ports system from root@celsius.bychok.com) - */ - - fpsetround(FP_RN); (void) fpsetmask(0L); #endif @@ -550,10 +542,10 @@ TclpInitLibraryPath( Tcl_DStringFree(&buffer); *encodingPtr = Tcl_GetEncoding(NULL, NULL); - str = Tcl_GetString(pathPtr); + str = TclGetString(pathPtr); *lengthPtr = pathPtr->length; - *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, str, (*lengthPtr)+1); + *valuePtr = ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } @@ -770,7 +762,7 @@ TclpSetVariables( CFLocaleRef localeRef; - if (CFLocaleCopyCurrent != NULL && CFLocaleGetIdentifier != NULL && + if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL && (localeRef = CFLocaleCopyCurrent())) { CFStringRef locale = CFLocaleGetIdentifier(localeRef); diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 9f9301f..e37962d 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -150,8 +150,8 @@ static int triggerPipe = -1; * The notifierMutex locks access to all of the global notifier state. */ -pthread_mutex_t notifierInitMutex = PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t notifierMutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t notifierInitMutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t notifierMutex = PTHREAD_MUTEX_INITIALIZER; /* * The following static indicates if the notifier thread is running. * diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 60a0055..170aea9 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -271,8 +271,8 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); *lengthPtr = strlen(native); - *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, native, (*lengthPtr)+1); + *valuePtr = ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, native, *lengthPtr + 1); } /* @@ -1098,7 +1098,7 @@ TcpConnect( { socklen_t optlen; int async_callback = statePtr->flags & TCP_ASYNC_PENDING; - int ret = -1, error = errno; + int ret = -1, error = EHOSTUNREACH; int async = statePtr->flags & TCP_ASYNC_CONNECT; if (async_callback) { @@ -1429,7 +1429,7 @@ Tcl_OpenTcpServer( * clients. */ ClientData acceptProcData) /* Data for the callback. */ { - int status = 0, sock = -1, reuseaddr = 1, chosenport = 0; + int status = 0, sock = -1, reuseaddr = 1, chosenport; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ TcpState *statePtr = NULL; char channelName[SOCK_CHAN_LENGTH]; @@ -1444,6 +1444,37 @@ Tcl_OpenTcpServer( enum { LOOKUP, SOCKET, BIND, LISTEN } howfar = LOOKUP; int my_errno = 0; + /* + * If we were called with port 0 to listen on a random port number, we + * copy the port number from the first member of the addrinfo list to all + * subsequent members, so that IPv4 and IPv6 listen on the same port. This + * might fail to bind() with EADDRINUSE if a port is free on the first + * address family in the list but already used on the other. In this case + * we revert everything we've done so far and start from scratch hoping + * that next time we'll find a port number that is usable on all address + * families. We try this at most MAXRETRY times to avoid an endless loop + * if all ports are taken. + */ + int retry = 0; +#define MAXRETRY 10 + + repeat: + if (retry > 0) { + if (statePtr != NULL) { + TcpCloseProc(statePtr, NULL); + statePtr = NULL; + } + if (addrlist != NULL) { + freeaddrinfo(addrlist); + addrlist = NULL; + } + if (retry >= MAXRETRY) { + goto error; + } + } + retry++; + chosenport = 0; + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { my_errno = errno; goto error; @@ -1512,6 +1543,9 @@ Tcl_OpenTcpServer( } close(sock); sock = -1; + if (port == 0 && errno == EADDRINUSE) { + goto repeat; + } continue; } if (port == 0 && chosenport == 0) { @@ -1535,6 +1569,9 @@ Tcl_OpenTcpServer( } close(sock); sock = -1; + if (port == 0 && errno == EADDRINUSE) { + goto repeat; + } continue; } if (statePtr == NULL) { diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 5030086..44c5607 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -662,7 +662,7 @@ void TclpInitAllocCache(void) { pthread_mutex_lock(allocLockPtr); - pthread_key_create(&key, TclpFreeAllocCache); + pthread_key_create(&key, NULL); pthread_mutex_unlock(allocLockPtr); } @@ -672,13 +672,19 @@ TclpFreeAllocCache( { if (ptr != NULL) { /* - * Called by the pthread lib when a thread exits + * Called by TclFinalizeThreadAllocThread() during the thread + * finalization initiated from Tcl_FinalizeThread() */ TclFreeAllocCache(ptr); pthread_setspecific(key, NULL); } else { + /* + * Called by TclFinalizeThreadAlloc() during the process + * finalization initiated from Tcl_Finalize() + */ + pthread_key_delete(key); } } |
