From b98ee2e66d8f576ab0efe7986faf70a0aada8836 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Fri, 11 Jan 2008 11:53:00 +0000 Subject: * unix/tclUnixThrd.c (TclpThreadGetStackSize): restore stack checking functionality in freebsd [Bug 1850424] --- ChangeLog | 3 +++ unix/tclUnixThrd.c | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ff3c65..c52bab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-01-11 Miguel Sofer + * unix/tclUnixThrd.c (TclpThreadGetStackSize): restore stack + checking functionality in freebsd [Bug 1850424] + * unix/tclUnixThrd.c (TclpThreadGetStackSize): fix for crash in freebsd [Bug 1860425]. diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index dfed046..0cb4b5d 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixThrd.c,v 1.56 2008/01/11 10:54:49 msofer Exp $ + * RCS: @(#) $Id: tclUnixThrd.c,v 1.57 2008/01/11 11:53:02 msofer Exp $ */ #include "tclInt.h" @@ -223,16 +223,13 @@ TclpThreadGetStackSize(void) #if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs) pthread_attr_t threadAttr; /* This will hold the thread attributes for * the current thread. */ - static int initialized = 0; - +#ifdef __GLIBC__ /* * Fix for [Bug 1815573] * * DESCRIPTION: * On linux TclpPthreadGetAttrs (which is pthread_attr_get_np) may return - * bogus values on the initial thread. We have a choice: either use the - * default thread stack (first branch in the #if below), or return 0 and - * let getrlimit do its thing. + * bogus values on the initial thread. * * ASSUMPTIONS: * There seems to be no api to determine if we are on the initial @@ -247,14 +244,20 @@ TclpThreadGetStackSize(void) * second Tcl interp will be created only after the first call to * Tcl_CreateInterp returns. * - * These assumptions are satisfied by tclsh. Embedders may want to check - * their validity, and possibly adapt the code on failing to meet them. + * These assumptions are satisfied by tclsh. Embedders on linux may want + * to check their validity, and possibly adapt the code on failing to meet + * them. */ + static int initialized = 0; + if (!initialized) { initialized = 1; return 0; } else { +#else + { +#endif if (pthread_attr_init(&threadAttr) != 0) { return -1; } -- cgit v0.12