diff --git a/lib/libc/pthread/thread/errno.c b/lib/libc/pthread/thread/errno.c new file mode 100644 index 0000000..c1d32c5 --- /dev/null +++ b/lib/libc/pthread/thread/errno.c @@ -0,0 +1,12 @@ +#include "pthread.h" + +#include +#include +#include + +int *__errno_location(void) +{ + struct __pthread *self = pthread_self(); + kern_logf("using pthread errno %p", &self->thr_errno); + return &self->thr_errno; +} diff --git a/lib/libc/pthread/thread/pthread.h b/lib/libc/pthread/thread/pthread.h index 3854097..905ea9d 100644 --- a/lib/libc/pthread/thread/pthread.h +++ b/lib/libc/pthread/thread/pthread.h @@ -9,6 +9,7 @@ enum pthread_flags { struct __pthread { struct __pthread *thr_self; + int thr_errno; enum pthread_flags thr_flags; kern_handle_t thr_handle; void *thr_map_base;