From: Ken Raeburn Date: Thu, 26 Apr 2001 03:47:29 +0000 (+0000) Subject: move socklen_t, socklen handling from krb5 library to include/k5-int.h X-Git-Tag: krb5-1.3-alpha1~1552 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d17088294e7ff5af099bf5f8336db259ac25cf45;p=krb5.git move socklen_t, socklen handling from krb5 library to include/k5-int.h git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13195 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/ChangeLog b/src/ChangeLog index 89d233f28..7ae63a661 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-04-25 Ken Raeburn + + * acconfig.h (HAVE_SOCKLEN_T): Add. + (HAS_VOID_TYPE): Delete. + 2001-04-17 Ken Raeburn * Makefile.in (unixmac): Target deleted. diff --git a/src/acconfig.h b/src/acconfig.h index 72a078313..e71089a5f 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -7,7 +7,6 @@ handle it on some systems. */ #undef ANSI_STDIO -#undef HAS_VOID_TYPE #undef KRB5_NO_PROTOTYPES #undef KRB5_PROVIDE_PROTOTYPES #undef KRB5_NO_NESTED_PROTOTYPES @@ -26,6 +25,9 @@ /* Define if struct sockaddr and friends (sockaddr_in etc) have the sa_len field. */ #undef HAVE_SA_LEN +/* Define if there is a socklen_t type; if not, size_t is probably + what we should use. */ +#undef HAVE_SOCKLEN_T /* Define if MIT Project Athena default configuration should be used */ #undef KRB5_ATHENA_COMPAT diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 1159f3dfd..88434bc2e 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,11 @@ +2001-04-25 Ken Raeburn + + * k5-int.h (socklen_t) [NEED_SOCKETS] [!HAVE_SOCKLEN_T]: Define as + typedef for size_t. + (socklen) [NEED_SOCKETS]: Define macro if not already defined. + * configure.in: Don't check for support for type "void". Move + socklen_t test here from krb5 library. + 2001-04-13 Ken Raeburn * Makefile.in (adm_err.h, asn1_err.h, krb5_err.h, kv5m_err.h): diff --git a/src/include/configure.in b/src/include/configure.in index cb002fb1c..faaea125b 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -51,18 +51,6 @@ if test $krb5_cv_struct_prototypes = no; then AC_DEFINE(KRB5_NO_NESTED_PROTOTYPES) fi dnl -dnl Check for void type -dnl -AC_MSG_CHECKING([void]) -AC_CACHE_VAL(krb5_cv_has_void_type, -[AC_TRY_COMPILE( -[void x();], [], -krb5_cv_has_void_type=yes, krb5_cv_has_void_type=no)]) -AC_MSG_RESULT($krb5_cv_has_void_type) -if test $krb5_cv_has_void_type = yes; then -AC_DEFINE(HAS_VOID_TYPE) -fi -dnl dnl Word sizes... AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) @@ -88,6 +76,19 @@ KRB5_RCTMPDIR=$krb5_cv_sys_rcdir AC_SUBST(KRB5_RCTMPDIR) dnl dnl +AC_MSG_CHECKING(for socklen_t) +AC_CACHE_VAL(krb5_cv_has_type_socklen_t, +[AC_TRY_COMPILE( +[#include +#include +],[sizeof (socklen_t);], +krb5_cv_has_type_socklen_t=yes,krb5_cv_has_type_socklen_t=no)]) +AC_MSG_RESULT($krb5_cv_has_type_socklen_t) +if test $krb5_cv_has_type_socklen_t = yes; then + AC_DEFINE(HAVE_SOCKLEN_T) +fi +dnl +dnl AC_ARG_ENABLE([athena], [ --enable-athena build with MIT Project Athena configuration], AC_DEFINE(KRB5_ATHENA_COMPAT),) diff --git a/src/include/k5-int.h b/src/include/k5-int.h index d2976a488..fa1ffd4a5 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -203,6 +203,28 @@ typedef unsigned char u_char; #ifdef NEED_SOCKETS #include "port-sockets.h" + +/* Either size_t or int or unsigned int is probably right. Under + SunOS 4, it looks like int is desired, according to the accept man + page. */ +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + +#if !defined (socklen) +/* size_t socklen (struct sockaddr *) */ +/* Should this return socklen_t instead? */ +# ifdef HAVE_SA_LEN +# define socklen(X) ((X)->sa_len) +# else +# ifdef KRB5_USE_INET6 +# define socklen(X) ((X)->sa_family == AF_INET6 ? sizeof (struct sockaddr_in6) : (X)->sa_family == AF_INET ? sizeof (struct sockaddr_in) : sizeof (struct sockaddr)) +# else +# define socklen(X) ((X)->sa_family == AF_INET ? sizeof (struct sockaddr_in) : sizeof (struct sockaddr)) +# endif +# endif +#endif + #else #ifndef SOCK_DGRAM struct sockaddr; diff --git a/src/lib/krb5/ChangeLog b/src/lib/krb5/ChangeLog index 643736d1d..0c07e50f6 100644 --- a/src/lib/krb5/ChangeLog +++ b/src/lib/krb5/ChangeLog @@ -1,3 +1,7 @@ +2001-04-25 Ken Raeburn + + * configure.in: Moved test for socklen_t to include directory. + 2001-03-05 Tom Yu * configure.in: Check for sys/filio.h for FIONBIO. diff --git a/src/lib/krb5/configure.in b/src/lib/krb5/configure.in index a12f8ddba..88ff70e1e 100644 --- a/src/lib/krb5/configure.in +++ b/src/lib/krb5/configure.in @@ -8,19 +8,6 @@ AC_TYPE_UID_T AC_TYPE_OFF_T dnl dnl -AC_MSG_CHECKING(for socklen_t) -AC_CACHE_VAL(krb5_cv_has_type_socklen_t, -[AC_TRY_COMPILE( -[#include -#include -],[sizeof (socklen_t);], -krb5_cv_has_type_socklen_t=yes,krb5_cv_has_type_socklen_t=no)]) -AC_MSG_RESULT($krb5_cv_has_type_socklen_t) -if test $krb5_cv_has_type_socklen_t = yes; then - AC_DEFINE(HAVE_SOCKLEN_T) -fi -dnl -dnl HAS_ANSI_VOLATILE AC_HEADER_STDARG AC_CHECK_HEADERS(unistd.h paths.h regex.h regexp.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index ceff3a62c..5ae26110f 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +2001-04-25 Ken Raeburn + + * localaddr.c (socklen_t, socklen): Deleted; definitions now in + k5-int.h instead. + 2001-03-31 Ken Raeburn * t_gifconf.c: New file. diff --git a/src/lib/krb5/os/localaddr.c b/src/lib/krb5/os/localaddr.c index 82c5863f9..1fc558d58 100644 --- a/src/lib/krb5/os/localaddr.c +++ b/src/lib/krb5/os/localaddr.c @@ -227,30 +227,6 @@ get_ifconf (int s, size_t *lenp, /*@out@*/ char *buf) return ret; } -#ifndef HAVE_SOCKLEN_T -typedef size_t socklen_t; -#endif - -static size_t -socklen (const struct sockaddr *sa) - /*@*/ -{ -#ifdef HAVE_SA_LEN - return sa->sa_len; -#else - switch (sa->sa_family) { - case AF_INET: - return sizeof (struct sockaddr_in); -#ifdef KRB5_USE_INET6 - case AF_INET6: - return sizeof (struct sockaddr_in6); -#endif - default: - return sizeof (struct sockaddr); - } -#endif -} - /* Return value is errno if internal stuff failed, otherwise zero, even in the case where a called function terminated the iteration.