Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] sa_family_t in cygwin compile of cvs

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: deststar <deststar(at)blueyonder(dot)co(dot)uk>
Cc: Jason Tishler <jason(at)tishler(dot)net>, pgsql-hackers(at)postgresql(dot)org,pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [HACKERS] sa_family_t in cygwin compile of cvs
Date: 2003-06-23 23:51:36
Message-ID: 200306232351.h5NNpal11953@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-cygwinpgsql-hackers
OK, I just applied a patch which should fix cygwin too.  Please give it
a try.  Thanks.

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

deststar wrote:
> 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>
> > 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 

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

In response to

pgsql-cygwin by date

Next:From: Bruce MomjianDate: 2003-06-23 23:59:48
Subject: Re: [HACKERS] sa_family_t in cygwin compile of cvs + regression failure
Previous:From: Bruce MomjianDate: 2003-06-23 23:49:26
Subject: Re: [HACKERS] ss_family in hba.c

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2003-06-23 23:59:48
Subject: Re: [HACKERS] sa_family_t in cygwin compile of cvs + regression failure
Previous:From: Bruce MomjianDate: 2003-06-23 23:49:26
Subject: Re: [HACKERS] ss_family in hba.c

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group