Skip to content

Commit

Permalink
LibC: Make h_errno thread-local
Browse files Browse the repository at this point in the history
  • Loading branch information
cocateh authored and awesomekling committed May 12, 2022
1 parent 0aee2ab commit bc18fa7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Userland/Libraries/LibC/netdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions Userland/Libraries/LibC/netdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc18fa7

Please sign in to comment.