apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/network_io/unix sa_common.c
Date Wed, 29 Aug 2001 15:20:24 GMT
trawick     01/08/29 08:20:24

  Modified:    .        CHANGES configure.in
               build    apr_network.m4
               include  apr_errno.h
               misc/unix errorcodes.c
               network_io/unix sa_common.c
  Log:
  Error codes from getaddrinfo() need their own range within the
  apr_status_t layout.  This is used to fix the bungling of these
  error codes.
  
  Revision  Changes    Path
  1.147     +2 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- CHANGES	2001/08/27 03:17:15	1.146
  +++ CHANGES	2001/08/29 15:20:23	1.147
  @@ -1,5 +1,7 @@
   Changes with APR b1  
   
  +  *) Fix the bungling of getaddrinfo() error codes.  [Jeff Trawick]
  +
     *) Add an apr_thread_once function to APR.  This allows a
        program to ensure that a function is only called once.
        [Ryan Bloom]
  
  
  
  1.363     +1 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.362
  retrieving revision 1.363
  diff -u -r1.362 -r1.363
  --- configure.in	2001/08/27 05:16:48	1.362
  +++ configure.in	2001/08/29 15:20:23	1.363
  @@ -1327,6 +1327,7 @@
   AC_SEARCH_LIBS(getaddrinfo, inet6)
   AC_SEARCH_LIBS(getnameinfo, inet6)
   APR_CHECK_WORKING_GETADDRINFO
  +APR_CHECK_NEGATIVE_EAI
   APR_CHECK_WORKING_GETNAMEINFO
   APR_CHECK_SOCKADDR_IN6
   AC_MSG_CHECKING(if APR supports IPv6)
  
  
  
  1.9       +28 -0     apr/build/apr_network.m4
  
  Index: apr_network.m4
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_network.m4,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- apr_network.m4	2001/07/31 06:15:41	1.8
  +++ apr_network.m4	2001/08/29 15:20:23	1.9
  @@ -104,6 +104,34 @@
   ])
   
   dnl
  +dnl check for negative error codes for getaddrinfo()
  +dnl
  +AC_DEFUN(APR_CHECK_NEGATIVE_EAI,[
  +  AC_CACHE_CHECK(for negative error codes for getaddrinfo, ac_cv_negative_eai,[
  +  AC_TRY_RUN( [
  +#ifdef HAVE_NETDB_H
  +#include <netdb.h>
  +#endif
  +
  +void main(void) {
  +    if (EAI_ADDRFAMILY < 0) {
  +        exit(0);
  +    }
  +    exit(1);
  +}
  +],[
  +  ac_cv_negative_eai="yes"
  +],[
  +  ac_cv_negative_eai="no"
  +],[
  +  ac_cv_negative_eai="no"
  +])])
  +if test "$ac_cv_negative_eai" = "yes"; then
  +  AC_DEFINE(NEGATIVE_EAI, 1, [Define if EAI_ error codes from getaddrinfo are negative])
  +fi
  +])
  +
  +dnl
   dnl check for gethostbyname() which handles numeric address strings
   dnl
   AC_DEFUN(APR_CHECK_GETHOSTBYNAME_NAS,[
  
  
  
  1.80      +6 -1      apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_errno.h,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- apr_errno.h	2001/08/24 17:55:45	1.79
  +++ apr_errno.h	2001/08/29 15:20:23	1.80
  @@ -153,6 +153,10 @@
    *     on systems which don't have the corresponding errno.
    */
   /**
  + * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into 
  + *     apr_status_t values.
  + */
  +/**
    * APR_OS_START_SYSERR folds platform-specific system error values into 
    *     apr_status_t values.
    */
  @@ -160,7 +164,8 @@
   #define APR_OS_START_STATUS    (APR_OS_START_ERROR + 500)
   #define APR_OS_START_USEERR    (APR_OS_START_STATUS + 500)
   #define APR_OS_START_CANONERR  (APR_OS_START_USEERR + 500)
  -#define APR_OS_START_SYSERR    (APR_OS_START_CANONERR + 500)
  +#define APR_OS_START_EAIERR    (APR_OS_START_CANONERR + 500)
  +#define APR_OS_START_SYSERR    (APR_OS_START_EAIERR + 500)
   
   #define APR_SUCCESS 0
   
  
  
  
  1.42      +11 -0     apr/misc/unix/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- errorcodes.c	2001/08/07 23:21:32	1.41
  +++ errorcodes.c	2001/08/29 15:20:24	1.42
  @@ -365,8 +365,19 @@
       else if (statcode < APR_OS_START_USEERR) {
           return stuffbuffer(buf, bufsize, apr_error_string(statcode));
       }
  +    else if (statcode < APR_OS_START_EAIERR) {
  +        return stuffbuffer(buf, bufsize, "APR does not understand this error code");
  +    }
       else if (statcode < APR_OS_START_SYSERR) {
  +#if defined(HAVE_GETADDRINFO)
  +        statcode -= APR_OS_START_EAIERR;
  +#if defined(NEGATIVE_EAI)
  +        statcode = -statcode;
  +#endif
  +        return stuffbuffer(buf, bufsize, gai_strerror(statcode));
  +#else
           return stuffbuffer(buf, bufsize, "APR does not understand this error code");
  +#endif
       }
       else {
           return apr_os_strerror(buf, bufsize, statcode - APR_OS_START_SYSERR);
  
  
  
  1.44      +8 -7      apr/network_io/unix/sa_common.c
  
  Index: sa_common.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- sa_common.c	2001/08/08 05:54:41	1.43
  +++ sa_common.c	2001/08/29 15:20:24	1.44
  @@ -355,14 +355,15 @@
                   return errno;
               }
               else {
  -                /* XXX fixme!
  -                 * no current way to represent this with APR's error
  -                 * scheme... note that glibc uses negative values for these
  -                 * numbers, perhaps so they don't conflict with h_errno
  -                 * values...  Tru64 uses positive values which conflict
  -                 * with h_errno values
  +                /* issues with representing this with APR's error scheme:
  +                 * glibc uses negative values for these numbers, perhaps so 
  +                 * they don't conflict with h_errno values...  Tru64 uses 
  +                 * positive values which conflict with h_errno values
                    */
  -                return error + APR_OS_START_SYSERR;
  +#if defined(NEGATIVE_EAI)
  +                error = -error;
  +#endif
  +                return error + APR_OS_START_EAIERR;
               }
           }
           cursa = *sa;
  
  
  

Mime
View raw message