From 0ebd75fda8a63c0f68da44dce7e4df35798ce78f Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 10 Aug 2021 10:20:54 +0000 Subject: [PATCH] changed to handle different sa_family_t sizes --- hio/configure | 5 +++++ hio/configure.ac | 1 + hio/lib/hio-cfg.h.in | 3 +++ hio/lib/hio-skad.h | 22 +++++++++++++++++----- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/hio/configure b/hio/configure index cbf1d0c..b802b27 100755 --- a/hio/configure +++ b/hio/configure @@ -18741,6 +18741,11 @@ cat >>confdefs.h <<_ACEOF _ACEOF +cat >>confdefs.h <<_ACEOF +#define HIO_SIZEOF_SA_FAMILY_T ${ac_cv_sizeof_sa_family_t} +_ACEOF + + hio_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`" hio_package_version_minor="`echo ${PACKAGE_VERSION} | cut -d. -f2`" diff --git a/hio/configure.ac b/hio/configure.ac index 04590df..51b4809 100644 --- a/hio/configure.ac +++ b/hio/configure.ac @@ -739,6 +739,7 @@ AC_DEFINE_UNQUOTED(HIO_SIZEOF_STRUCT_SOCKADDR_UN, ${ac_cv_sizeof_struct_sockaddr AC_DEFINE_UNQUOTED(HIO_SIZEOF_STRUCT_SOCKADDR_LL, ${ac_cv_sizeof_struct_sockaddr_ll}, [sizeof(struct sockaddr_ll)]) AC_DEFINE_UNQUOTED(HIO_SIZEOF_STRUCT_SOCKADDR_DL, ${ac_cv_sizeof_struct_sockaddr_dl}, [sizeof(struct sockaddr_dl)]) AC_DEFINE_UNQUOTED(HIO_SIZEOF_SOCKLEN_T, ${ac_cv_sizeof_socklen_t}, [sizeof(socklen_t)]) +AC_DEFINE_UNQUOTED(HIO_SIZEOF_SA_FAMILY_T, ${ac_cv_sizeof_sa_family_t}, [sizeof(sa_family_t)]) hio_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`" diff --git a/hio/lib/hio-cfg.h.in b/hio/lib/hio-cfg.h.in index 1cb983e..27fc13d 100644 --- a/hio/lib/hio-cfg.h.in +++ b/hio/lib/hio-cfg.h.in @@ -633,6 +633,9 @@ /* sizeof(off_t) */ #undef HIO_SIZEOF_OFF_T +/* sizeof(sa_family_t) */ +#undef HIO_SIZEOF_SA_FAMILY_T + /* sizeof(short) */ #undef HIO_SIZEOF_SHORT diff --git a/hio/lib/hio-skad.h b/hio/lib/hio-skad.h index adc68e8..a7af248 100644 --- a/hio/lib/hio-skad.h +++ b/hio/lib/hio-skad.h @@ -52,12 +52,24 @@ # define HIO_SIZEOF_SKAD_T HIO_SIZEOF_STRUCT_SOCKADDR_UN #endif -#if !defined(HIO_AF_UNIX) - /* this is a fake value */ -# define HIO_AF_UNIX (65534) +#if (HIO_SIZEOF_SA_FAMILY_T == 1) && !defined(HIO_SA_FAMILY_T_IS_SIGNED) +# if !defined(HIO_AF_UNIX) +# define HIO_AF_UNIX (254) +# endif +# define HIO_AF_QX (255) +#elif (HIO_SIZEOF_SA_FAMILY_T == 1) && defined(HIO_SA_FAMILY_T_IS_SIGNED) +# if !defined(HIO_AF_UNIX) +# define HIO_AF_UNIX (-2) +# endif +# define HIO_AF_QX (-1) +#else +# if !defined(HIO_AF_UNIX) + /* this is a fake value */ +# define HIO_AF_UNIX (65534) +# endif + /* this is HIO specific. No AF_XXXX definitions must overlap with this */ +# define HIO_AF_QX (65530) #endif -/* this is HIO specific. No AF_XXXX definitions must overlap with this */ -#define HIO_AF_QX (65530) struct hio_skad_t {