summaryrefslogtreecommitdiff
path: root/src/thread/pthread_attr_get.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-11-07 20:47:24 -0500
committerRich Felker <dalias@aerifal.cx>2016-11-07 20:47:24 -0500
commit33ce920857405d4f4b342c85b74588a15e2702e5 (patch)
tree54c7c840b40b68aa52f68a0a69c9e61b9ac4c388 /src/thread/pthread_attr_get.c
parent7442442ccc665641a8827177e8e7ed45bbbd6584 (diff)
downloadmusl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.gz
simplify pthread_attr_t stack/guard size representation
previously, the pthread_attr_t object was always initialized all-zero, and stack/guard size were represented as differences versus their defaults. this required lots of confusing offset arithmetic everywhere they were used. instead, have pthread_attr_init fill in the default values, and work with absolute sizes everywhere.
Diffstat (limited to 'src/thread/pthread_attr_get.c')
-rw-r--r--src/thread/pthread_attr_get.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/thread/pthread_attr_get.c b/src/thread/pthread_attr_get.c
index 3d296bf3..4aa5afdb 100644
--- a/src/thread/pthread_attr_get.c
+++ b/src/thread/pthread_attr_get.c
@@ -7,7 +7,7 @@ int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state)
}
int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
{
- *size = a->_a_guardsize + DEFAULT_GUARD_SIZE;
+ *size = a->_a_guardsize;
return 0;
}
@@ -39,14 +39,14 @@ int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr
{
if (!a->_a_stackaddr)
return EINVAL;
- *size = a->_a_stacksize + DEFAULT_STACK_SIZE;
+ *size = a->_a_stacksize;
*addr = (void *)(a->_a_stackaddr - *size);
return 0;
}
int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
{
- *size = a->_a_stacksize + DEFAULT_STACK_SIZE;
+ *size = a->_a_stacksize;
return 0;
}