LibC: Make errno macro directly access uthread

This allows inlining errno usages

This breaks libc ABI and requires toolchain rebuild
This commit is contained in:
2026-04-07 03:12:21 +03:00
parent e0af23a924
commit 80c4213501
3 changed files with 4 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ set(LIBC_SOURCES
dlfcn.cpp
endian.cpp
environ.cpp
errno.cpp
fcntl.cpp
fenv.cpp
fnmatch.cpp

View File

@@ -1,7 +0,0 @@
#include <errno.h>
#include <pthread.h>
int* __errno_location()
{
return &_get_uthread()->errno_;
}

View File

@@ -7,6 +7,10 @@
__BEGIN_DECLS
#include <bits/types/uthread.h>
#define errno (_get_uthread()->errno_)
#define E2BIG 1
#define EACCES 2
#define EADDRINUSE 3
@@ -94,10 +98,6 @@ __BEGIN_DECLS
#define ERESTART 0xFE /* internal errno for SA_RESTART */
#define EUNKNOWN 0xFF
#define errno (*__errno_location())
int* __errno_location(void);
__END_DECLS
#endif