lib: c: pthread: implement per-thread errno storage
This commit is contained in:
12
lib/libc/pthread/thread/errno.c
Normal file
12
lib/libc/pthread/thread/errno.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "pthread.h"
|
||||
|
||||
#include <mango/log.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int *__errno_location(void)
|
||||
{
|
||||
struct __pthread *self = pthread_self();
|
||||
kern_logf("using pthread errno %p", &self->thr_errno);
|
||||
return &self->thr_errno;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user