<resolv.h> requires <netinet/in.h>

Pierre A. Humblet pierre@phumblet.no-ip.org
Tue Dec 9 15:13:00 GMT 2008


----- Original Message ----- 
From: "Corinna Vinschen" <corinna-cygwin@cygwin.com>
To: <cygwin-patches@cygwin.com>
Sent: Tuesday, December 09, 2008 4:23 AM
Subject: Re: <resolv.h> requires <netinet/in.h>


| On Dec  8 17:52, Yaakov (Cygwin/X) wrote:
| > -----BEGIN PGP SIGNED MESSAGE-----
| > Hash: SHA256
| > 
| > Pierre A. Humblet wrote:
| > > Every version of man resolver that I have ever seen specifies:
| > > 
| > > SYNOPSIS 
| > >      #include <sys/types.h>
| > >      #include <netinet/in.h>
| > >      #include <arpa/nameser.h>
| > >      #include <resolv.h>
| > > 
| > > So it's up to the user to include the right files.
| > 
| > Perhaps so, but:
| > 
| > 1) <resolv.h> already #includes all of those headers *except* for
| > <netinet/in.h>.
| > 
| > 2) this does not match Linux behaviour:
| > 
| > http://sourceware.org/cgi-bin/cvsweb.cgi/libc/resolv/resolv.h?cvsroot=glibc
| > 
| > As I stated, my STC was based on a configure test which works on other
| > platforms; I don't see why we shouldn't match that.
| > 
| > > Sure we can make an exception for Cygwin, but the same program can then fail elsewhere.
| > 
| > I agree that for portability, a program should not assume that #include
| > <resolv.h> automatically #include <netinet/in.h> and use the latter's
| > functions or typedefs.  But the bottom line here is that <resolv.h>
| > requires struct sockaddr_in, so it needs that #include.
| 
| Good point.  Pierre?

I don't know why the original resolv.h didn't include netinet/in.h and 
I have no problem adding it in Cygwin, given it was added in Linux.
The minires package is nearing its life end, so I would make the change
starting with the built-in resolver.

Pierre
 



More information about the Cygwin-patches mailing list