[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclibc
Subject:    [uClibc] Pthread stack allocation
From:       chris.gray () kiffer ! be (Chris Gray)
Date:       2005-05-31 15:57:19
Message-ID: 200505312221.44300.chris.gray () kiffer ! be
[Download RAW message or body]

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@kiffer.be                         +32 3 216 0369

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic