Re: [HACKERS] sa_family_t in cygwin compile of cvs - Mailing list pgsql-cygwin

From Bruce Momjian
Subject Re: [HACKERS] sa_family_t in cygwin compile of cvs
Date
Msg-id 200306180112.h5I1Cu509293@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] sa_family_t in cygwin compile of cvs  (deststar <deststar@blueyonder.co.uk>)
Responses Re: [HACKERS] sa_family_t in cygwin compile of cvs
List pgsql-cygwin
I am confused why you didn't like the following patch I posted, which
pulls the family data type length right out of the structure, rather than
having to configure it for every OS that doesn't have sa_family_t?

---------------------------------------------------------------------------

deststar wrote:
> Jason Tishler wrote:
> > On Sun, Jun 15, 2003 at 04:54:21PM +0100, deststar wrote:
> >
> >>On cygwin sa_family_t was undeclared, adding the following line:
> >>typedef unsigned short sa_family_t;
> >>to both:
> >>src/port/getaddrinfo.c
> >>src/include/libpq/pqcomm.h
> >
> >
> > Isn't the attached or fixing Cygwin itself a better approach?
> >
> >
> Yes it does seem better, attached is a proposed patch to cygwin.h &
> configure.in (incase cygwin gets it in future)
> Have tested with make installcheck & it works fine.
> If you see no problems I will sumit to patches
> thanks,

--
  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
Index: src/include/libpq/pqcomm.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/libpq/pqcomm.h,v
retrieving revision 1.86
diff -c -c -r1.86 pqcomm.h
*** src/include/libpq/pqcomm.h    12 Jun 2003 07:36:51 -0000    1.86
--- src/include/libpq/pqcomm.h    16 Jun 2003 21:11:09 -0000
***************
*** 43,57 ****
  /*
   * Definitions used for sockaddr_storage structure paddings design.
   */
! #define    _SS_PAD1SIZE    (_SS_ALIGNSIZE - sizeof (sa_family_t))
! #define    _SS_PAD2SIZE    (_SS_MAXSIZE - (sizeof (sa_family_t) + \
                  _SS_PAD1SIZE + _SS_ALIGNSIZE))

  struct sockaddr_storage {
  #ifdef SALEN
      uint8_t    __ss_len;        /* address length */
  #endif
!     sa_family_t    ss_family;    /* address family */

      char    __ss_pad1[_SS_PAD1SIZE];
          /* 6 byte pad, this is to make implementation
--- 43,60 ----
  /*
   * Definitions used for sockaddr_storage structure paddings design.
   */
! /* Some platforms don't have sa_family_t, so we compute it ourselves */
! #define SIZEOF_SOCKADDR_FAMILY        sizeof(((struct sockaddr *)0)->sa_family)
!
! #define    _SS_PAD1SIZE    (_SS_ALIGNSIZE - SIZEOF_SOCKADDR_FAMILY)
! #define    _SS_PAD2SIZE    (_SS_MAXSIZE - (SIZEOF_SOCKADDR_FAMILY + \
                  _SS_PAD1SIZE + _SS_ALIGNSIZE))

  struct sockaddr_storage {
  #ifdef SALEN
      uint8_t    __ss_len;        /* address length */
  #endif
!     char dummy_sa_family[SIZEOF_SOCKADDR_FAMILY];

      char    __ss_pad1[_SS_PAD1SIZE];
          /* 6 byte pad, this is to make implementation

pgsql-cygwin by date:

Previous
From: deststar
Date:
Subject: Re: [HACKERS] sa_family_t in cygwin compile of cvs
Next
From: deststar
Date:
Subject: Re: [HACKERS] sa_family_t in cygwin compile of cvs