On 02/29/2016 07:52 AM, Eli Zaretskii wrote: > I was talking about systems other than Windows. Do we know which ones > of them still use the non-getaddrinfo code? The Gnulib documentation mentions HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 7, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS. Of the non-MS-Windows ports, Emacs should run on HP-UX 11, Solaris 7, and (assuming --with-wide-int) IRIX 6.5. Of these only HP-UX 11.11 (aka HP-UX 11i) is still a viable platform. The base system lacks getaddrinfo, but there is an optional addon to support getaddrinfo (it's part of IPv6 support) > I see that we have calls to something named res_init there, and we > even have a configure-time test for that. What is that about? Gnulib > doesn't have that, and it's certainly not for the MS-Windows build. res_init originally had to do with the ancient (pre-2000) BIND interfaces that were not thread-safe. Emacs doesn't use those so we don't need to worry about them. More recently, res_init was used to kick glibc into re-reading /etc/resolv.conf. That has been obsolete for years too, with the emergence of nscd. Nowadays calling res_init merely slows Emacs down so Emacs should stop doing it, and I installed the attached patch into master. > The current w32 code in Emacs wraps each network-related function with > a wrapper that tracks sockets and file descriptors they use, > translates socket errors to errno values, and does other important > stuff. The code also arranges for dynamically loading the socket > library only when actually needed. So replacing just one function will > certainly not work well, and replacing them all sounds like a lot of > work for very little gain. So I think a better way forward would be to > implement getaddrinfo wrapper in w32.c, complete with the fallback we > have in process.c (and maybe also borrowing some ideas from Gnulib). Gnulib also tracks file descriptors in its substitute functions, I presume for similar reasons. At some point perhaps this should be unified with what Emacs does, but obviously this is not high priority. > When this is done, we can install your patch for whatever other > systems which still don't have getaddrinfo (if there are such systems > that we still support). Writing such a getaddrinfo wrapper is easy, > and I expect it to be done soon enough, so please wait with your patch > until then. Sounds good.