mirror of
https://github.com/fluencelabs/musl
synced 2025-05-28 23:21:34 +00:00
store pthread stack guard sizes for pthread_getattr_np
This commit is contained in:
parent
b3ae7beabb
commit
7c709f2d4f
@ -46,6 +46,7 @@ struct pthread {
|
|||||||
char *dlerror_buf;
|
char *dlerror_buf;
|
||||||
int dlerror_flag;
|
int dlerror_flag;
|
||||||
void *stdio_locks;
|
void *stdio_locks;
|
||||||
|
size_t guard_size;
|
||||||
uintptr_t canary_at_end;
|
uintptr_t canary_at_end;
|
||||||
void **dtv_copy;
|
void **dtv_copy;
|
||||||
};
|
};
|
||||||
|
@ -232,8 +232,8 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
|
|||||||
memset(stack, 0, need);
|
memset(stack, 0, need);
|
||||||
} else {
|
} else {
|
||||||
size = ROUND(need);
|
size = ROUND(need);
|
||||||
guard = 0;
|
|
||||||
}
|
}
|
||||||
|
guard = 0;
|
||||||
} else {
|
} else {
|
||||||
guard = ROUND(attr._a_guardsize);
|
guard = ROUND(attr._a_guardsize);
|
||||||
size = guard + ROUND(attr._a_stacksize
|
size = guard + ROUND(attr._a_stacksize
|
||||||
@ -265,6 +265,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
|
|||||||
new->map_size = size;
|
new->map_size = size;
|
||||||
new->stack = stack;
|
new->stack = stack;
|
||||||
new->stack_size = stack - stack_limit;
|
new->stack_size = stack - stack_limit;
|
||||||
|
new->guard_size = guard;
|
||||||
new->start = entry;
|
new->start = entry;
|
||||||
new->start_arg = arg;
|
new->start_arg = arg;
|
||||||
new->self = new;
|
new->self = new;
|
||||||
|
@ -7,6 +7,7 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a)
|
|||||||
{
|
{
|
||||||
*a = (pthread_attr_t){0};
|
*a = (pthread_attr_t){0};
|
||||||
a->_a_detach = !!t->detached;
|
a->_a_detach = !!t->detached;
|
||||||
|
a->_a_guardsize = t->guard_size;
|
||||||
if (t->stack) {
|
if (t->stack) {
|
||||||
a->_a_stackaddr = (uintptr_t)t->stack;
|
a->_a_stackaddr = (uintptr_t)t->stack;
|
||||||
a->_a_stacksize = t->stack_size;
|
a->_a_stacksize = t->stack_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user