This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Initializing initial bottom of stack variable in pthread.c
- From: Daniel Jacobowitz <drow at false dot org>
- To: Jay anonymous <j2list468 at yahoo dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 31 Jul 2006 21:49:38 -0400
- Subject: Re: Initializing initial bottom of stack variable in pthread.c
- References: <20060728220832.35633.qmail@web57101.mail.re3.yahoo.com>
On Fri, Jul 28, 2006 at 03:08:32PM -0700, Jay anonymous wrote:
> I downloaded glibc-linuxthreads-2.3.6.tar.gz and took
> a look at the __pthread_initial_thread_bos variable in
> pthread_initialize for the case when the stack grows
> down (line 534). My first question is why is is it
> initializing for at least STACK_SIZE bytes below the
> current stack address? Is this to account for the
> stack for the initial thread & the stack for the
> manager thread? My second question is why the 2 *
> STACK_SIZE in the computation? Since the stack is
> growing down and the computation consists of the &
> ~(STACK_SIZE - 1), this actually initializes the
> variable to 3 * STACK_SIZE from the top. Is this
> correct?
No, this allocates STACK_SIZE for the manager thread and then
_at least_ STACK_SIZE for the initial thread. Could be up to
2 * STACK_SIZE - 1, but will be at least as big as requested.
--
Daniel Jacobowitz
CodeSourcery