[uClibc] Pthread stack allocation
Chris Gray
chris.gray at kiffer.be
Tue May 31 20:21:44 UTC 2005
Hi all,
We're porting an application (Java VM) to uClinux using pthreads, and we're
having some problems. If this is the wrong place to ask, or if there is some
friendly document I need to go away and read, please tell me.
We use pthread_attr_setstackaddr() and pthread_attr_setstacksize() for the
threads we create. The macros _POSIX_THREAD_ATTR_STACKADDR and
_POSIX_THREAD_ATTR_STACKSIZE are defined, so I would expect this to work.
However, I observe the following:
1. After setting the thread stack address and size, calls to
pthread_attr_getstackaddr() and pthread_attr_getstacksize() return (nil) and
2xxxxxx respectively.
2. Printing out the address of an automatic variable in the thread's startup
routine shows an address somewhat higher than the program's static data, but
not 2M (0x00200000) higher.
3. With stack overflow detection enabled in the kernel, we receive a message
indicating a stack limit somewhat less than 16K lower than the address
printed out in (2).
It looks as though (i) the pthread_attr_setstackaddr/size() functions don't do
their job, and (ii) the default stack size is 16KB, not 2MB as claimed by
pthread_attr_getstacksize().
Is it possible to re-compile the pthread sources for uClib in such a way as to
remedy (i)? Alternatively, is it possible to change the default stack size
globally?
Thanks for any help,
Chris Gray
--
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
chris.gray at kiffer.be +32 3 216 0369
More information about the uClibc
mailing list