Обсуждение: Re: [HACKERS] ss_family in hba.c

Поиск
Список
Период
Сортировка

Re: [HACKERS] ss_family in hba.c

От
Bruce Momjian
Дата:
Kurt Roeckx wrote:
> On Mon, Jun 23, 2003 at 07:49:11PM -0400, Bruce Momjian wrote:
> >
> > I have applied a patch to CVS to fix the problem.  It is all your patch,
> > except for the part you got from me, which was wrong.  :-(
> >
> > It took me a while to realize the subtlety of your patch.  First, it
> > removes the use of sa_family_t _except_ for cases that don't have
> > SOCKADDR_STORAGE, where it is required.  Second, it allows for a
> > structure member named ss_family or __ss_family, tested via configure.
> >
> > This should fix most platforms.  I am not sure how cygwin is going to
> > handle this --- we might have to add a specific sa_family_t typedef for
> > that platform --- MinGW does have sa_family_t, but probably doesn't need
> > it anyway.  Testing for the size of sa_family_t is possible via
> > configure, but if only cygwin needs it, we can just hard-code that
> > platform in the template files.  Cygwin folks, would you test CVS and
> > let me know.
>
> There are probably other systems that don't have sa_family_t yet,
> but they should be rather old.  Even my Solaris 2.6 already seems
> to have it.
>
> What I was confused about is, is that cygwin seems to have a
> struct sockaddr_storage in the first place (in winsock2.h).  I'm
> not sure what problem he really had since he only told it how he
> solved it.
>
> All that probably needed to change for cygwin was to no longer
> use sa_family_t in the getaddrinfo.c.

But Jason reported he needed that typedef for sa_family_t.  Jason, is
that accurate.  If you remove the Cygwin typedef in pqcomm.h, does the
compile fail?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: [HACKERS] ss_family in hba.c

От
Jason Tishler
Дата:
Bruce,

On Tue, Jun 24, 2003 at 03:04:05PM -0400, Bruce Momjian wrote:
> Kurt Roeckx wrote:
> > All that probably needed to change for cygwin was to no longer
> > use sa_family_t in the getaddrinfo.c.
>
> But Jason reported he needed that typedef for sa_family_t.  Jason, is
> that accurate.

Yes.

> If you remove the Cygwin typedef in pqcomm.h, does the compile fail?

Yes:

    gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../../src/include  -DBUILDING_DLL  -c -o
printtup.oprinttup.c 
    In file included from ../../../../src/include/libpq/libpq-be.h:22,
                     from ../../../../src/include/libpq/libpq.h:21,
                     from printtup.c:20:
    ../../../../src/include/libpq/pqcomm.h:54: parse error before "sa_family_t"
    [snip]

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Re: [HACKERS] ss_family in hba.c

От
Kurt Roeckx
Дата:
On Tue, Jun 24, 2003 at 04:10:13PM -0400, Jason Tishler wrote:
> Bruce,
>
> On Tue, Jun 24, 2003 at 03:04:05PM -0400, Bruce Momjian wrote:
> > Kurt Roeckx wrote:
> > > All that probably needed to change for cygwin was to no longer
> > > use sa_family_t in the getaddrinfo.c.
> >
> > But Jason reported he needed that typedef for sa_family_t.  Jason, is
> > that accurate.
>
> Yes.
>
> > If you remove the Cygwin typedef in pqcomm.h, does the compile fail?

It seems that struct sockaddr_storage is defined in winsock2.h,
but that is only included in the win32 port.

Maybe the right solution is the include that winsock2.h instead
(through windows.h?)  And make sure configure also includes it
when doing the checks.

The headers even seem to define struct sockaddr_in6, getaddrinfo
and getnameinfo, so I wonder if cygwin supports ipv6 or not.


Kurt