How to determine a threads stack size?

Greetings all,

I am working on a product that uses QNX. I was wondering if there is a way to determine what a thread’s stack size is? Specifically a thread that is already created.

I have read through Pthreads Programming, and the QNX library reference and it seems like the usage of pthread_attr_getstacksize() used with pthread_attr_init() is a way to determine what the stack size WILL be for the attribute we are going to pass to a thread during creation time.

Actually, if I recall my tracing correctly this is the main thread, so it doesn’t even have a call to pthread_create().

Is there a way to determine the stack size after the thread has already been created?

Thanks for your help.

-=John

I don`t recall the method at the moment, but that being said you have control on the stack size. Either via the -N option when you compile/link and when you create the thread.

There is “what the maximum size of the thread stack”, and there is “what’s the current size of the thread stack”, depends on which one you want to find.

Since “pidin mem” can display both, you could grab the pidin source and cut out that part…

You want to do a DCMD_PROC_STATUS devctl on the thread, and in the procfs_status structure there is stkbase and stksize