diff options
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/pthread_attr_getstack.c | 4 | ||||
-rw-r--r-- | nptl/pthread_attr_setstack.c | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/nptl/pthread_attr_getstack.c b/nptl/pthread_attr_getstack.c index 3f4fd8d..0e245a0 100644 --- a/nptl/pthread_attr_getstack.c +++ b/nptl/pthread_attr_getstack.c @@ -32,7 +32,11 @@ __pthread_attr_getstack (attr, stackaddr, stacksize) iattr = (struct pthread_attr *) attr; /* Store the result. */ +#if _STACK_GROWS_DOWN *stackaddr = (char *) iattr->stackaddr - iattr->stacksize; +#else + *stackaddr = (char *) iattr->stackaddr; +#endif *stacksize = iattr->stacksize; return 0; diff --git a/nptl/pthread_attr_setstack.c b/nptl/pthread_attr_setstack.c index 19a5b54..4785501 100644 --- a/nptl/pthread_attr_setstack.c +++ b/nptl/pthread_attr_setstack.c @@ -48,7 +48,11 @@ __pthread_attr_setstack (attr, stackaddr, stacksize) #endif iattr->stacksize = stacksize; +#if _STACK_GROWS_DOWN iattr->stackaddr = (char *) stackaddr + stacksize; +#else + iattr->stackaddr = (char *) stackaddr; +#endif iattr->flags |= ATTR_FLAG_STACKADDR; return 0; @@ -81,7 +85,11 @@ __old_pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, # endif iattr->stacksize = stacksize; +#if _STACK_GROWS_DOWN iattr->stackaddr = (char *) stackaddr + stacksize; +#else + iattr->stackaddr = (char *) stackaddr; +#endif iattr->flags |= ATTR_FLAG_STACKADDR; return 0; |