libthr and main thread stack size

Ivan A. Kosarev ivan at
Thu Aug 7 12:27:33 UTC 2014


According to libthr's thr_init.c (the 9.2 version) init_main_thread() 
allocates s.c. "red zone" below the main stack in order to protect other 
stacks. The size of the main stack is determined by the 
_thr_stack_initial variable that is declared extern though it doesn't 
seem it can be changed. The value of the variable is set to 4M on 64-bit 
platforms which is obviously not sufficient for the most of real programs.

Can anyone please confirm that there is no way to increase the stack 
size for the main thread and thus any program linked against libthr has 
only a few megabytes of stack memory for its main thread--whatever the 
system stack size (ulimit -s) is set to?



More information about the freebsd-current mailing list