From bc18fa75ecf000e9771ec6b4835d9241122fdd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lach?= Date: Tue, 10 May 2022 12:58:55 +0200 Subject: [PATCH] LibC: Make h_errno thread-local --- Userland/Libraries/LibC/netdb.cpp | 4 ++++ Userland/Libraries/LibC/netdb.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 45b13b39e15..96b934a662a 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -19,7 +19,11 @@ extern "C" { +#ifdef NO_TLS int h_errno; +#else +__thread int h_errno; +#endif static hostent __gethostbyname_buffer; static in_addr_t __gethostbyname_address; diff --git a/Userland/Libraries/LibC/netdb.h b/Userland/Libraries/LibC/netdb.h index eec4f3b4969..8fff8cc471b 100644 --- a/Userland/Libraries/LibC/netdb.h +++ b/Userland/Libraries/LibC/netdb.h @@ -48,7 +48,11 @@ struct protoent* getprotobynumber(int proto); struct protoent* getprotoent(void); void setprotoent(int stay_open); +#ifdef NO_TLS extern int h_errno; +#else +extern __thread int h_errno; +#endif #define HOST_NOT_FOUND 101 #define NO_DATA 102