
|
[openbeosnetteam]
||
[Date Prev]
[02-2004 Date Index]
[Date Next]
||
[Thread Prev]
[02-2004 Thread Index]
[Thread Next]
[openbeosnetteam] Re: Fix for resolving host names
- From: "Philippe Houdoin" <philippe.houdoin@xxxxxxx>
- To: openbeosnetteam@xxxxxxxxxxxxx
- Date: Mon, 02 Feb 2004 23:59:26 GMT
> > >Where is h_errno implemented?
In current/headers/posix/netdb.h:
(http://cvs.sourceforge.net/viewcvs.py/open-beos/current/headers/posix/
netdb.h?rev=1.5&view=auto)
extern int *_h_errnop(void);
#define h_errno (*(_h_errnop()))
Basicly, every access to h_errno (pseudo-) global variable will turn,
in fact, as an access to the int value stored at
address returned by _h_errnop();
So, where is _h_errnop(), you may ask...
In current/src/kits/network/compat.c
(http://cvs.sourceforge.net/viewcvs.py/open-beos/current/src/kits/
network/libnet/compat.c?rev=1.5&view=auto)
static int32 h_errno_tls;
_EXPORT int *_h_errnop()
{
return (int *)tls_address(h_errno_tls);
}
_EXPORT void initialize_before(void)
{
h_errno_tls = tls_allocate();
}
h_errno try to mimic our thread-specific errno implementatio, using
Thread Local Storage (TLS) service.
Each thread can have is own h_errno value that way.
_h_errnop() returns the address of the calling thread h_errno int.
At libnet.so startup, initialize_before() is supposed to be called by
ELF loader to setup the TLS storage space
for all h_errno threads.
Maybe initialize_before() is not called at libnet.so load time!?
In that case, _h_errnop() will return NULL, which easily explain a
segfauld in second DNS call...
- Philippe
--
Fortune Cookie Says:
"...and the fully armed nuclear warheads, are, of course, merely a
courtesy detail."
|

|