From 500354bed1dd1c346a7638475fdd9a3c4be70184 Mon Sep 17 00:00:00 2001 From: das Date: Mon, 16 Oct 2006 18:41:25 +0000 Subject: * unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main thread, where pthread_get_stacksize_np() returns incorrect info. * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires. --- ChangeLog | 9 +++++++-- macosx/GNUmakefile | 11 +++++++---- unix/tclUnixThrd.c | 15 ++++++++++----- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78a3b60..a415b95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,18 @@ 2006-10-16 Andreas Kupries + *** 8.5a5 TAGGED FOR RELEASE *** + * generic/tclBasic.c: Moved TIP#219 cleanup to DeleteInterpProc. 2006-10-16 Daniel Steffen - *** 8.5a5 TAGGED FOR RELEASE *** - * changes: updates for 8.5a5 release. + * unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main + thread, where pthread_get_stacksize_np() returns incorrect info. + + * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires. + 2006-10-16 Don Porter * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index 950ed50..7bcedf2 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -4,7 +4,7 @@ # uses the standard unix build system in tcl/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # -# RCS: @(#) $Id: GNUmakefile,v 1.3 2006/04/12 00:58:01 das Exp $ +# RCS: @(#) $Id: GNUmakefile,v 1.4 2006/10/16 18:41:25 das Exp $ # ######################################################################################################## @@ -154,14 +154,17 @@ ifeq (${EMBEDDED_BUILD},1) @rm -f "${INSTALL_ROOT}${BINDIR}/${TCLSH}" && \ rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true else -# redo prebinding - @cd ${INSTALL_ROOT}/ && \ +# redo prebinding (when not building for Mac OS X 10.4 or later only) + @if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | \ + awk -F '10\\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | \ + awk -F '-mmacosx-version-min=10\\.' '{print int($$2)}'`" -lt 4 ]; \ + then cd ${INSTALL_ROOT}/; \ if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \ if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \ redo_prebinding -r . "./${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}/${PRODUCT_NAME}"; \ redo_prebinding -r . "./${BINDIR}/${TCLSH}"; \ if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \ - if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi + if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; fi # install tclsh symbolic link @ln -fs ${TCLSH} ${INSTALL_ROOT}${BINDIR}/tclsh endif diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 57795ab..adc508f 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -215,10 +215,10 @@ TclpThreadExit( int TclpThreadGetStackSize(void) { + size_t stackSize = 0; #if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs) pthread_attr_t threadAttr; /* This will hold the thread attributes for * the current thread. */ - size_t stackSize; if (pthread_attr_init(&threadAttr) != 0) { return -1; @@ -232,17 +232,22 @@ TclpThreadGetStackSize(void) return -1; } pthread_attr_destroy(&threadAttr); - return (int) stackSize; #elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) - return (int) pthread_get_stacksize_np(pthread_self()); +#ifdef __APPLE__ + /* + * On Darwin, the API below does not return the correct stack size for the + * main thread (which is not a real pthread), so fallback to getrlimit(). + */ + if (!pthread_main_np()) +#endif + stackSize = pthread_get_stacksize_np(pthread_self()); #else /* * Cannot determine the real stack size of this thread. The caller might * want to try looking at the process accounting limits instead. */ - - return 0; #endif + return (int) stackSize; } #endif /* TCL_THREADS */ -- cgit v0.12