lib: c: pthread: implement per-thread errno storage

This commit is contained in:
2026-03-22 19:09:18 +00:00
parent dd46a378b3
commit a792bbe5db
2 changed files with 13 additions and 0 deletions

View 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;
}

View File

@@ -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;