Subject: Re: HEADS UP: migration to fully dynamic linked "base" system
To: None <current-users@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 08/26/2002 21:20:03
> > No, it's not correct behavior.  There's the "which global variable do
> > you use, errno or errno?" problem.
> 
> Ooops. I realized that, and others also already pointed it out.
> errno (atleast) needs to be exported. Oh well, I stand (very) corrected on
> that. :-)

But _nd_error doesn't (on SVR4), and if the user program is only
linked with libc, but getpw* (say) is networked so dlopen() libnsl.so
the name2addr (resolv style) routines are dlopen()ed by by code in libnsl.
We now have 3 namespaces, the name2addr routines are required to
write status into the same copy of the global variable as the libnsl
code will look at.  By default that doesn't happen unless the variable
exists in the program body (which it won't in this case).
The name2addr code has to do a dlsym() request with the 'handle' for
libnsl - which it can only get by dlopen()ing libnsl again.
Of course, if it was called from a different intermediary library
it won't get the right copy.
(However that did fix the cases that actually happened.)

	David

-- 
David Laight: david@l8s.co.uk