reorganize pthread data structures and move the definitions to alltypes.h

this allows sys/types.h to provide the pthread types, as required by
POSIX. this design also facilitates forcing ABI-compatible sizes in
the arch-specific alltypes.h, while eliminating the need for
developers changing the internals of the pthread types to poke around
with arch-specific headers they may not be able to test.
This commit is contained in:
Rich Felker 2011-02-17 17:16:20 -05:00
commit e882756311
28 changed files with 158 additions and 128 deletions

View file

@ -173,8 +173,8 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo
if (!init && ++init) init_threads();
if (!attr) attr = &default_attr;
guard = ROUND(attr->__guardsize + DEFAULT_GUARD_SIZE);
size = guard + ROUND(attr->__stacksize + DEFAULT_STACK_SIZE);
guard = ROUND(attr->_a_guardsize + DEFAULT_GUARD_SIZE);
size = guard + ROUND(attr->_a_stacksize + DEFAULT_STACK_SIZE);
size += __pthread_tsd_size;
map = mmap(0, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0);
if (!map) return EAGAIN;
@ -190,7 +190,7 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo
new->start_arg = arg;
new->self = new;
new->tsd = (void *)tsd;
new->detached = attr->__detach;
new->detached = attr->_a_detach;
new->attr = *attr;
memcpy(new->tlsdesc, self->tlsdesc, sizeof new->tlsdesc);
new->tlsdesc[1] = (uintptr_t)new;