1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibC: Add NO_TLS preprocessor flag

When this flag is defined, LibC does not use TLS.
It will be useful for the dynamic loader.
This commit is contained in:
Itamar 2020-10-10 17:48:27 +03:00 committed by Andreas Kling
parent 65ee2f07b7
commit 781aa424a9
3 changed files with 14 additions and 0 deletions

View file

@ -43,7 +43,12 @@ __BEGIN_DECLS
extern const char* const sys_errlist[]; extern const char* const sys_errlist[];
extern int sys_nerr; extern int sys_nerr;
#ifdef NO_TLS
extern int errno;
#else
extern __thread int errno; extern __thread int errno;
#endif
#define errno errno #define errno errno

View file

@ -31,7 +31,11 @@
extern "C" { extern "C" {
#ifdef NO_TLS
int errno;
#else
__thread int errno; __thread int errno;
#endif
char** environ; char** environ;
bool __environ_is_malloced; bool __environ_is_malloced;
bool __stdio_is_initialized; bool __stdio_is_initialized;

View file

@ -48,7 +48,12 @@
extern "C" { extern "C" {
#ifdef NO_TLS
static int s_cached_tid = 0;
#else
static __thread int s_cached_tid = 0; static __thread int s_cached_tid = 0;
#endif
static int s_cached_pid = 0; static int s_cached_pid = 0;
int chown(const char* pathname, uid_t uid, gid_t gid) int chown(const char* pathname, uid_t uid, gid_t gid)