Adding asynchronous name resolution to GlibC (was: Reproposed F19 Feature: Fix Network Name Resolution)

Kamil Dudka kdudka at redhat.com
Fri Jan 18 23:36:16 UTC 2013


On Friday, January 18, 2013 23:35:24 Lennart Poettering wrote:
> On Fri, 18.01.13 22:49, Andreas Tunek (andreas.tunek at gmail.com) wrote:
> > I think you have a good point, but adding every imaginable featw into
> > glibc
> > is not really a good solution. Maybe glib is a better place for these
> > kinds
> > of functions?
> 
> Because doing this externally is really hard. I wrote a library for that
> named "libasyncns", and glib's async resolver is based on that.

libcurl uses threads to wrap the glibc's name resolver two years now and, 
although it is not the default option, it does not generate so many bugs
as the setjmp/longjmp based timeout implementation, or using c-ares.

> libasyncns is different from other libraries for resolving host names in
> that i actually uses the NSS, rather than just implementing DNS on its
> own. This has the benefit actually all kinds of hostnames are supported,
> including those served from LDAP, NIS, mDNS and whatever the user
> prefers. Now, since NSS and the libc APIs around it are inherentlich
> synchronous the only way to make them asynchronous without touching
> glibc is by running them in a separate thread/process. And doing that
> behind the back of the user is kinda problematic from libraries.

Yes, some libraries would like to be thread-safe without any locking,
which is currently incompatible with asynchronous name lookups.

Kamil


More information about the devel mailing list