store pthread stack guard sizes for pthread_getattr_np
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index f0b2c20..4a0db98 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -46,6 +46,7 @@
char *dlerror_buf;
int dlerror_flag;
void *stdio_locks;
+ size_t guard_size;
uintptr_t canary_at_end;
void **dtv_copy;
};
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 34cd993..439ee36 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -232,8 +232,8 @@
memset(stack, 0, need);
} else {
size = ROUND(need);
- guard = 0;
}
+ guard = 0;
} else {
guard = ROUND(attr._a_guardsize);
size = guard + ROUND(attr._a_stacksize
@@ -265,6 +265,7 @@
new->map_size = size;
new->stack = stack;
new->stack_size = stack - stack_limit;
+ new->guard_size = guard;
new->start = entry;
new->start_arg = arg;
new->self = new;
diff --git a/src/thread/pthread_getattr_np.c b/src/thread/pthread_getattr_np.c
index ae26a5a..29a209b 100644
--- a/src/thread/pthread_getattr_np.c
+++ b/src/thread/pthread_getattr_np.c
@@ -7,6 +7,7 @@
{
*a = (pthread_attr_t){0};
a->_a_detach = !!t->detached;
+ a->_a_guardsize = t->guard_size;
if (t->stack) {
a->_a_stackaddr = (uintptr_t)t->stack;
a->_a_stacksize = t->stack_size;