diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-11-07 20:47:24 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-11-07 20:47:24 -0500 |
commit | 33ce920857405d4f4b342c85b74588a15e2702e5 (patch) | |
tree | 54c7c840b40b68aa52f68a0a69c9e61b9ac4c388 /src/thread/pthread_getattr_np.c | |
parent | 7442442ccc665641a8827177e8e7ed45bbbd6584 (diff) | |
download | musl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.gz musl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.bz2 musl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.xz musl-33ce920857405d4f4b342c85b74588a15e2702e5.zip |
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_getattr_np.c')
-rw-r--r-- | src/thread/pthread_getattr_np.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/thread/pthread_getattr_np.c b/src/thread/pthread_getattr_np.c index 10ea5127..ae26a5ab 100644 --- a/src/thread/pthread_getattr_np.c +++ b/src/thread/pthread_getattr_np.c @@ -9,7 +9,7 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a) a->_a_detach = !!t->detached; if (t->stack) { a->_a_stackaddr = (uintptr_t)t->stack; - a->_a_stacksize = t->stack_size - DEFAULT_STACK_SIZE; + a->_a_stacksize = t->stack_size; } else { char *p = (void *)libc.auxv; size_t l = PAGE_SIZE; @@ -17,7 +17,7 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a) a->_a_stackaddr = (uintptr_t)p; while (mremap(p-l-PAGE_SIZE, PAGE_SIZE, 2*PAGE_SIZE, 0)==MAP_FAILED && errno==ENOMEM) l += PAGE_SIZE; - a->_a_stacksize = l - DEFAULT_STACK_SIZE; + a->_a_stacksize = l; } return 0; } |