Re: sa_family_t in cygwin compile of cvs - Mailing list pgsql-hackers

From deststar
Subject Re: sa_family_t in cygwin compile of cvs
Date
Msg-id 3EF790B4.4060201@blueyonder.co.uk
Whole thread Raw
In response to Re: sa_family_t in cygwin compile of cvs  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: sa_family_t in cygwin compile of cvs
List pgsql-hackers
Yes there's:
struct sockaddr {
   unsigned short    sa_family;    /* address family, AF_xxx    */
   char            sa_data[14];    /* 14 bytes of protocol address    */
};
in socket.h

struct sockaddr {
    u_short sa_family;
    char    sa_data[14];
};
in winsock.h & winsock2.h

typedef struct sockaddr_ipx {
    short sa_family;
    char sa_netnum[4];
    char sa_nodenum[6];
    unsigned short sa_socket;
} SOCKADDR_IPX, *PSOCKADDR_IPX, *LPSOCKADDR_IPX;
in wsipx.h

and for ss_family:
struct sockaddr_storage {
     short ss_family;
     char __ss_pad1[6];    /* pad to 8 */
     __int64 __ss_align; /* force alignment */
     char __ss_pad2[112];  /* pad to 128 */
};
in winsock2.h

To be honest I'm not at all sure about the correctness of my patch as I
don't know what sa_family is for, I just did a search on google and
unsigned short seemd to be the answer & it seemed to pass the regression
test.
regards,
- Stuart

Bruce Momjian wrote:

> deststar, is there any sa_family or ss_family in the cygwin include
> directory, perhap with double leading underscores?
>
> ---------------------------------------------------------------------------
>
> 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,
>>- Stuart
>
>
>>*** src/include/port/cygwin.h.orig    Thu May 22 18:20:28 2003
>>--- src/include/port/cygwin.h    Tue Jun 17 22:31:04 2003
>>***************
>>*** 21,23 ****
>>--- 21,28 ----
>>  #else
>>  #define DLLIMPORT __declspec (dllimport)
>>  #endif
>>+
>>+ #ifndef HAVE_SA_FAMILY_T
>>+ typedef unsigned short sa_family_t;
>>+ #endif
>>+
>
>
>>*** configure.in.orig    Sun Jun 15 05:07:58 2003
>>--- configure.in    Tue Jun 17 22:22:24 2003
>>***************
>>*** 855,860 ****
>>--- 855,866 ----
>>  [$ac_includes_default
>>  #include <netinet/in.h>])
>>
>>+ AC_CHECK_TYPE(sa_family_t,
>>+               [AC_DEFINE(HAVE_SA_FAMILY_T,1,[Cygwin does not have sa_family_t defined so test])],
>>+               [],
>>+           [$ac_includes_default
>>+               #include <netinet/in.h>])
>>+
>>  AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
>>  [AC_TRY_LINK(
>>  [#include <machine/vmparam.h>
>



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: sa_family_t in cygwin compile of cvs
Next
From: Bruce Momjian
Date:
Subject: Re: ss_family in hba.c