This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Problem with stack size in pthreads
On Thu, Jul 12, 2001 at 12:55:56PM -0700, Hui Huang wrote:
> Ulrich Drepper wrote:
>
> > Andreas Jaeger <aj@suse.de> writes:
> >
> >
> >>>This is not supposed to happen because we made a setrlimit() call.
> >>>Testcase?
> >>>
> >>JDK :-(
> >>
> >
> > Right! Nice joke.
> >
> >
>
> Why do you think it's a joke? It's a bug.
>
> Call getrlimit(RLIMIT_STACK, &rlim) in any C program and run it with
> "LD_ASSUME_KERNEL=2.2.5", you'll see stack limit is not correctly set.
> I assume you want to set stack limit to STACK_SIZE-pagesize = 2040K,
> but no, it's not set to that value.
>
That is because __pthread_init_max_stacksize is not called in your
testcase. Should we always call __pthread_init_max_stacksize for
pthreads, something like the patch encloded here?
H.J.
----
--- linuxthreads/pthread.c.stack Mon Jun 18 14:19:54 2001
+++ linuxthreads/pthread.c Fri Jul 13 23:40:26 2001
@@ -408,6 +408,8 @@ static void pthread_initialize(void)
/* If already done (e.g. by a constructor called earlier!), bail out */
if (__pthread_initial_thread_bos != NULL) return;
+ if (__pthread_max_stacksize == 0)
+ __pthread_init_max_stacksize ();
#ifdef TEST_FOR_COMPARE_AND_SWAP
/* Test if compare-and-swap is available */
__pthread_has_cas = compare_and_swap_is_available();