[PATCH 1/2] Set default stack size from program environment
Siddhesh Poyarekar
siddhesh@redhat.com
Wed Jan 16 06:54:00 GMT 2013
On Tue, Jan 15, 2013 at 10:53:59AM -0500, KOSAKI Motohiro wrote:
> > void
> > -__pthread_initialize_minimal_internal (void)
> > +__pthread_initialize_minimal_internal (int argc, char **argv, char **envp)
>
> argc and argv are unsed?
Yes, that's the signature call_init in ld.so assumes for constructors,
so it's either void or that signature.
> > +int
> > +__pthread_set_default_stacksize_np (size_t stacksize)
> > +{
> > + if (stacksize < PTHREAD_STACK_MIN)
> > + return -EINVAL;
> > +
> > + __adjust_and_set_stacksize (stacksize);
> > +
> > + return 0;
> > +}
>
> and here call __adjust_and_set_stacksize() even if __pthread_set_default_stacksize_np()
> return -EINVAL. so why do you need to call __pthread_set_default_stacksize_np()?
>
If __pthread_set_default_stacksize_np returns EINVAL, I call
__adjust_and_set_stacksize with PTHREAD_STACK_MIN so that if the
stacksize we get (either fomr the environment or using ulimit) is not
sufficient, we set the default stacksize to the minimum required.
Siddhesh
More information about the Libc-alpha
mailing list