Multithreaded Programming Guide

Getting the Stack Address and Size

pthread_attr_getstack(3C) returns the thread stack address and size set by pthread_attr_setstack().

pthread_attr_getstack Syntax

int pthread_attr_getstack(pthread_attr_t *restrict tattr,
         void **restrict stackaddr, size_t *restrict stacksize);
#include <pthread.h>

pthread_attr_t tattr;
void *base;
size_t size;
int ret;

/* getting a stack address and size */
ret = pthread_attr_getstack (&tattr
, &base, &size); 

pthread_attr_getstack Return Values

pthread_attr_getstack() returns zero after completing successfully. Any other return value indicates that an error occurred. If the following condition occurs, the function fails and returns the corresponding value.



The value of tattr is incorrect.