Remove references to sa_family_t, except when SOCKADDR_STORAGE requires
it. Also handle __ss_family as a synonym for ss_family. Kurt Roeckx
This commit is contained in:
parent
6403a6729c
commit
99308891ef
@ -1,5 +1,5 @@
|
|||||||
# Macros that test various C library quirks
|
# Macros that test various C library quirks
|
||||||
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.21 2003/06/12 16:05:10 tgl Exp $
|
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.22 2003/06/23 23:51:59 momjian Exp $
|
||||||
|
|
||||||
|
|
||||||
# PGAC_VAR_INT_TIMEZONE
|
# PGAC_VAR_INT_TIMEZONE
|
||||||
@ -110,6 +110,19 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE],
|
|||||||
#endif
|
#endif
|
||||||
])])# PGAC_STRUCT_SOCKADDR_STORAGE
|
])])# PGAC_STRUCT_SOCKADDR_STORAGE
|
||||||
|
|
||||||
|
# PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
|
||||||
|
# --------------------------------------
|
||||||
|
# This checks if the struct sockaddr has a proper ss_family and not an
|
||||||
|
# __ss_family as rfc2553 defined.
|
||||||
|
AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY],
|
||||||
|
[AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family,
|
||||||
|
struct sockaddr_storage.__ss_family], [], [],
|
||||||
|
[#include <sys/types.h>
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
])])# PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
|
||||||
|
|
||||||
|
|
||||||
# PGAC_STRUCT_ADDRINFO
|
# PGAC_STRUCT_ADDRINFO
|
||||||
# -----------------------
|
# -----------------------
|
||||||
|
121
configure
vendored
121
configure
vendored
@ -9869,6 +9869,127 @@ cat >>confdefs.h <<_ACEOF
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking for struct sockaddr_storage.ss_family" >&5
|
||||||
|
echo $ECHO_N "checking for struct sockaddr_storage.ss_family... $ECHO_C" >&6
|
||||||
|
if test "${ac_cv_member_struct_sockaddr_storage_ss_family+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
#line $LINENO "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef F77_DUMMY_MAIN
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int F77_DUMMY_MAIN() { return 1; }
|
||||||
|
#endif
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
static struct sockaddr_storage ac_aggr;
|
||||||
|
if (ac_aggr.ss_family)
|
||||||
|
return 0;
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
ac_cv_member_struct_sockaddr_storage_ss_family=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
ac_cv_member_struct_sockaddr_storage_ss_family=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_storage_ss_family" >&5
|
||||||
|
echo "${ECHO_T}$ac_cv_member_struct_sockaddr_storage_ss_family" >&6
|
||||||
|
if test $ac_cv_member_struct_sockaddr_storage_ss_family = yes; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: checking for struct sockaddr_storage.__ss_family" >&5
|
||||||
|
echo $ECHO_N "checking for struct sockaddr_storage.__ss_family... $ECHO_C" >&6
|
||||||
|
if test "${ac_cv_member_struct_sockaddr_storage___ss_family+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
#line $LINENO "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef F77_DUMMY_MAIN
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int F77_DUMMY_MAIN() { return 1; }
|
||||||
|
#endif
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
static struct sockaddr_storage ac_aggr;
|
||||||
|
if (ac_aggr.__ss_family)
|
||||||
|
return 0;
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
ac_cv_member_struct_sockaddr_storage___ss_family=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
ac_cv_member_struct_sockaddr_storage___ss_family=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_storage___ss_family" >&5
|
||||||
|
echo "${ECHO_T}$ac_cv_member_struct_sockaddr_storage___ss_family" >&6
|
||||||
|
if test $ac_cv_member_struct_sockaddr_storage___ss_family = yes; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$as_me:$LINENO: checking for struct addrinfo" >&5
|
echo "$as_me:$LINENO: checking for struct addrinfo" >&5
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $Header: /cvsroot/pgsql/configure.in,v 1.266 2003/06/18 16:04:15 momjian Exp $
|
dnl $Header: /cvsroot/pgsql/configure.in,v 1.267 2003/06/23 23:51:59 momjian Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -778,6 +778,7 @@ PGAC_STRUCT_TIMEZONE
|
|||||||
PGAC_UNION_SEMUN
|
PGAC_UNION_SEMUN
|
||||||
PGAC_STRUCT_SOCKADDR_UN
|
PGAC_STRUCT_SOCKADDR_UN
|
||||||
PGAC_STRUCT_SOCKADDR_STORAGE
|
PGAC_STRUCT_SOCKADDR_STORAGE
|
||||||
|
PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
|
||||||
PGAC_STRUCT_ADDRINFO
|
PGAC_STRUCT_ADDRINFO
|
||||||
|
|
||||||
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
|
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pqcomm.h,v 1.86 2003/06/12 07:36:51 momjian Exp $
|
* $Id: pqcomm.h,v 1.87 2003/06/23 23:51:59 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -65,6 +65,12 @@ struct sockaddr_storage {
|
|||||||
* _SS_MAXSIZE value minus size of ss_family
|
* _SS_MAXSIZE value minus size of ss_family
|
||||||
* __ss_pad1, __ss_align fields is 112 */
|
* __ss_pad1, __ss_align fields is 112 */
|
||||||
};
|
};
|
||||||
|
#elif !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
|
||||||
|
# ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
|
||||||
|
# define ss_family __ss_family
|
||||||
|
# else
|
||||||
|
# error struct sockaddr_storage does not provide an ss_family member
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -423,6 +423,12 @@
|
|||||||
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
|
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
|
||||||
#undef HAVE_STRUCT_SOCKADDR_STORAGE
|
#undef HAVE_STRUCT_SOCKADDR_STORAGE
|
||||||
|
|
||||||
|
/* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
|
||||||
|
#undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
|
||||||
|
|
||||||
|
/* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */
|
||||||
|
#undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `struct sockaddr_un'. */
|
/* Define to 1 if the system has the type `struct sockaddr_un'. */
|
||||||
#undef HAVE_STRUCT_SOCKADDR_UN
|
#undef HAVE_STRUCT_SOCKADDR_UN
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.8 2003/06/14 18:20:33 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.9 2003/06/23 23:52:00 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -220,7 +220,6 @@ getnameinfo(const struct sockaddr *sa, int salen,
|
|||||||
char *node, int nodelen,
|
char *node, int nodelen,
|
||||||
char *service, int servicelen, int flags)
|
char *service, int servicelen, int flags)
|
||||||
{
|
{
|
||||||
sa_family_t family;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
/* Invalid arguments. */
|
/* Invalid arguments. */
|
||||||
@ -236,9 +235,8 @@ getnameinfo(const struct sockaddr *sa, int salen,
|
|||||||
return EAI_FAIL;
|
return EAI_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
family = sa->sa_family;
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (family == AF_INET6)
|
if (sa->sa_family == AF_INET6)
|
||||||
{
|
{
|
||||||
return EAI_FAMILY;
|
return EAI_FAMILY;
|
||||||
}
|
}
|
||||||
@ -246,13 +244,13 @@ getnameinfo(const struct sockaddr *sa, int salen,
|
|||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
{
|
{
|
||||||
if (family == AF_INET)
|
if (sa->sa_family == AF_INET)
|
||||||
{
|
{
|
||||||
ret = snprintf(service, servicelen, "%d",
|
ret = snprintf(service, servicelen, "%d",
|
||||||
ntohs(((struct sockaddr_in *)sa)->sin_port));
|
ntohs(((struct sockaddr_in *)sa)->sin_port));
|
||||||
}
|
}
|
||||||
#ifdef HAVE_UNIX_SOCKETS
|
#ifdef HAVE_UNIX_SOCKETS
|
||||||
else if (family == AF_UNIX)
|
else if (sa->sa_family == AF_UNIX)
|
||||||
{
|
{
|
||||||
ret = snprintf(service, servicelen, "%s",
|
ret = snprintf(service, servicelen, "%s",
|
||||||
((struct sockaddr_un *)sa)->sun_path);
|
((struct sockaddr_un *)sa)->sun_path);
|
||||||
@ -266,14 +264,14 @@ getnameinfo(const struct sockaddr *sa, int salen,
|
|||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
if (family == AF_INET)
|
if (sa->sa_family == AF_INET)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
|
p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
|
||||||
ret = snprintf(node, nodelen, "%s", p);
|
ret = snprintf(node, nodelen, "%s", p);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_UNIX_SOCKETS
|
#ifdef HAVE_UNIX_SOCKETS
|
||||||
else if (family == AF_UNIX)
|
else if (sa->sa_family == AF_UNIX)
|
||||||
{
|
{
|
||||||
ret = snprintf(node, nodelen, "%s", "localhost");
|
ret = snprintf(node, nodelen, "%s", "localhost");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user