Subject: Re: resolver library thread safety
To: Noriyuki Soda <firstname.lastname@example.org>
From: None <email@example.com>
Date: 01/18/2003 09:31:40
>How using bind8 hostent/servent/NIS functions helps this?
bind8 hostent/servent/NIS lookup API internally uses per-thread data
structs right. it is true gethostent() API itself is not thread safe,
it need not be. but internally there are private API code which is
thread safe. it makes a huge difference.
for instance, getservent() calls getservent_p(), which keeps
per-thread data around by argument pointer (src/lib/irs/getservent.c).
any private data needed to do getservent() work is kept in dynamically-
allocated structure, not the file static variable, to make bottom layer
thread safe (for instance, NIS-related data is kept in struct pvt
pointed to by irs_sv - see lib/irs/nis_sv.c).
>It seems those functions in bind8/bind9 library aren't really
>thread safe. For example, gethostbyname_r() in bind9 library calls
>gethostbyname() internally (without any mutex). :-O
>It seems other hostent/servent/NIS functions in bind9 library aren't
>thread safe, either.
you are looking at the wrong code.