This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Set default stack size from program environment
On Wed, Jan 16, 2013 at 04:07:52PM -0800, Roland McGrath wrote:
> If the new API functions are worth having, then make the case for them and
> post a patch doing nothing but that.
The API functions basically just complete the user-visible
functionality. The real feature (that I care about) is the
environment variable.
> The addition of a new magical environment variable is especially suspect
> and will need a lot of justification and consideration. That is separate
> from adding functions.
Currently, the only legitimate way to limit sizes of thread stacks
(when one cannot modify the source) is to set RLIMIT_STACK to a low
enough value. But this also affects the main process stack, which is
not desirable. The non-legitimate way (since it's really a hack and
not a 'solution') would be to write an instrumentation that gets
preloaded and wraps the pthread_create function.
Also, we're not the first ones to implement a tunable for thread stack
sizes. AIX has AIXTHREAD_STK[1] and Solaris has
lwp_default_stksize[2] that do exactly this.
Siddhesh
[1] http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.prftungd%2Fdoc%2Fprftungd%2Fthread_supp_tun_params.htm
[2] http://docs.oracle.com/cd/E19455-01/816-0607/chapter2-118/index.html