You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@locus.apache.org on 2000/04/21 21:32:12 UTC

cvs commit: apache-2.0/src/lib/apr/misc/win32 canonerr.c errorcodes.c

stoddard    00/04/21 12:32:12

  Modified:    src/lib/apr aprlib.dsp
  Added:       src/lib/apr/misc/win32 canonerr.c errorcodes.c
  Log:
  Win32: Begin adding ap_strerror and ap_canonicalize_error to APR. Server
  will compile and serve pages again!
  
  Revision  Changes    Path
  1.19      +8 -0      apache-2.0/src/lib/apr/aprlib.dsp
  
  Index: aprlib.dsp
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/aprlib.dsp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- aprlib.dsp	2000/04/21 13:46:13	1.18
  +++ aprlib.dsp	2000/04/21 19:32:11	1.19
  @@ -122,11 +122,19 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\misc\win32\canonerr.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\file_io\win32\dir.c
   # End Source File
   # Begin Source File
   
   SOURCE=.\dso\win32\dso.c
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\misc\win32\errorcodes.c
   # End Source File
   # Begin Source File
   
  
  
  
  1.1                  apache-2.0/src/lib/apr/misc/win32/canonerr.c
  
  Index: canonerr.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "misc.h"
  
  /*
   * Map Windows system errors to APR specific error codes.
   * This routine should only be called when it is necessary to 
   * selectively react to errors returned by APR functions.
   * 
   * hack alert:
   * Certain Windows APR routines already canonicalize their 
   * return codes in most (and maybe all) cases that are
   * interesting to Apache. For now, canonicalization 
   * on Windows is a no-op.
   */
  int ap_canonical_error(ap_status_t code)
  {
      return code;
  }
  
  
  
  1.1                  apache-2.0/src/lib/apr/misc/win32/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "misc.h"
  
  
  static const char *apr_error_string(ap_status_t statcode)
  {
      switch (statcode) {
      case APR_ENOPOOL:
          return "A new pool could not be created.";
      case APR_ENOFILE:
          return "No file was provided and one was required.";
      case APR_EBADDATE:
          return "An invalid date has been provided";
      case APR_EINVALSOCK:
          return "An invalid socket was returned";
      case APR_ENOPROC:
          return "No process was provided and one was required.";
      case APR_ENOTIME:
          return "No time was provided and one was required.";
      case APR_ENODIR:
          return "No directory was provided and one was required.";
      case APR_ENOLOCK:
          return "No lock was provided and one was required.";
      case APR_ENOPOLL:
          return "No poll structure was provided and one was required.";
      case APR_ENOSOCKET:
          return "No socket was provided and one was required.";
      case APR_ENOTHREAD:
          return "No thread was provided and one was required.";
      case APR_ENOTHDKEY:
          return "No thread key structure was provided and one was required.";
      case APR_ENOSHMAVAIL:
          return "No shared memory is currently available";
      case APR_EDSOOPEN:
          return "Could not open the dso.";
      case APR_INCHILD:
          return
  	    "Your code just forked, and you are currently executing in the "
  	    "child process";
      case APR_INPARENT:
          return
  	    "Your code just forked, and you are currently executing in the "
  	    "parent process";
      case APR_DETACH:
          return "The specified thread is detached";
      case APR_NOTDETACH:
          return "The specified thread is not detached";
      case APR_CHILD_DONE:
          return "The specified child process is done executing";
      case APR_CHILD_NOTDONE:
          return "The specified child process is not done executing";
      case APR_TIMEUP:
          return "The timeout specified has expired";
      case APR_BADCH:
          return "Bad character specified on command line";
      case APR_BADARG:
          return "Missing parameter for the specified command line option";
      case APR_EOF:
          return "End of file found";
      case APR_NOTFOUND:
          return "Could not find specified socket in poll list.";
      case APR_ANONYMOUS:
          return "Shared memory is implemented anonymously";
      case APR_FILEBASED:
          return "Shared memory is implemented using files";
      case APR_KEYBASED:
          return "Shared memory is implemented using a key system";
      case APR_EINIT:
          return
  	    "There is no error, this value signifies an initialized "
  	    "error code";
      case APR_ENOTIMPL:
          return "This function has not been implemented on this platform";
      case APR_EMISMATCH:
          return "passwords do not match";
  /* EBADARG needs to be removed soon.  */
      case APR_EBADARG:
      default:
          return "Error string not specified yet";
      }
  }
  
  static char *ap_os_format_message(ap_status_t code, char *buf, size_t bufsize)
  {
      strcpy(buf, "Not implemented\n");
      return buf;
  }
  
  const char *ap_strerror(ap_status_t statcode, ap_pool_t *p)
  {
      size_t bufsize = 100;
      char *buf = ap_pcalloc(p, bufsize);
  
      if (statcode < APR_OS_START_ERROR) {
          return ap_os_format_message(statcode, buf, bufsize);
      }
      else if (statcode < APR_OS_START_USEERR) {
          return apr_error_string(statcode);
      }
      else if (statcode < APR_OS_START_SYSERR) {
          return "APR does not understand this error code";
      }
      else {
  	return ap_os_format_message(statcode - APR_OS_START_SYSERR, buf, bufsize);
      }
  }
  
  
  
  
  

Re: cvs commit: apache-2.0/src/lib/apr/misc/win32 canonerr.c errorcodes.c

Posted by Greg Stein <gs...@lyra.org>.
Is there any way to share the apr_error_string() implementation with Unix?
I see that ap_strerror() itself is different enough that they cannot be
shared.

Cheers,
-g

On 21 Apr 2000 stoddard@locus.apache.org wrote:
> stoddard    00/04/21 12:32:12
> 
>   Modified:    src/lib/apr aprlib.dsp
>   Added:       src/lib/apr/misc/win32 canonerr.c errorcodes.c
>   Log:
>   Win32: Begin adding ap_strerror and ap_canonicalize_error to APR. Server
>   will compile and serve pages again!

-- 
Greg Stein, http://www.lyra.org/