mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
make h_errno thread-local
the framework to do this always existed but it was deemed unnecessary because the only [ex-]standard functions using h_errno were not thread-safe anyway. however, some of the nonstandard res_* functions are also supposed to set h_errno to indicate the cause of error, and were unable to do so because it was not thread-safe. this change is a prerequisite for fixing them.
This commit is contained in:
parent
4d5786544b
commit
9d0b8b92a5
2 changed files with 3 additions and 4 deletions
|
@ -43,6 +43,7 @@ struct pthread {
|
||||||
long off;
|
long off;
|
||||||
volatile void *volatile pending;
|
volatile void *volatile pending;
|
||||||
} robust_list;
|
} robust_list;
|
||||||
|
int h_errno_val;
|
||||||
volatile int timer_id;
|
volatile int timer_id;
|
||||||
locale_t locale;
|
locale_t locale;
|
||||||
volatile int killlock[1];
|
volatile int killlock[1];
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#include "pthread_impl.h"
|
||||||
#undef h_errno
|
|
||||||
int h_errno;
|
|
||||||
|
|
||||||
int *__h_errno_location(void)
|
int *__h_errno_location(void)
|
||||||
{
|
{
|
||||||
return &h_errno;
|
return &__pthread_self()->h_errno_val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue