coar        99/01/21 12:57:30

  Modified:    docs     apr-function.txt
  Added:       include  apr_status.h
  Log:
        Add a start to the status-parsing macros, and correct some
        misteaks in the draft status definition.
  
  Obtained from:        OpenVMS status code definition scheme
  
  Revision  Changes    Path
  1.2       +23 -6     apache-apr/docs/apr-function.txt
  
  Index: apr-function.txt
  ===================================================================
  RCS file: /home/cvs/apache-apr/docs/apr-function.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apr-function.txt  1999/01/21 20:02:10     1.1
  +++ apr-function.txt  1999/01/21 20:57:29     1.2
  @@ -42,10 +42,12 @@
   <h1>APRStatus Layout</h1>
   
   This is based on how VMS lays out its error codes. We haven't decided at
  -all whether this is a good thing or not.
  +all whether this is a good thing or not.  However, I18N of VMS error
  +messages was made very easy by this arrangement, as was determining the
  +source of errors.
   
  -APRStatus is basically a 32-bit integer. We will use 16-bits to describe the
  -nature of the specific error, and the other 16-bits are layed out as follows:
  +APRStatus is basically a 32-bit integer. We will use 12 bits to describe the
  +nature of the specific error, and the other 18 bits are laid out as follows:
   
     the three low-order bits describe the type of error as:
         000 (0): Warning (things didn't quite go right, but the
  @@ -60,15 +62,30 @@
         101 (5): Undefined, no problems
         110 (6): Undefined, problems
         111 (7): Undefined, no problems
  -  The other 13 bits are an origin
  +
  +   This allows a 'it worked/need to check further' decision to be based
  +   on the low bit (odd or even).
  +
  +  The next 12 bits (3-14) are the actual error number (4095 possible).
  +
  +  Bit 15 indicates whether the error is specific to the raising subsystem
  +  (see the next field) or shared.
  +
  +  Bits 16-28 are an origin identifying the subsystem raising the error; e.g.,
         0      : File System
  -      2      : Shell
  +      1      : Shell
  +      2      : Thread system
         3      : Internal APR
  +      4           : OS syscalls
         etc.  NOTE: These are not set, just some beginning ideas.  Obviously, 
                  this needs to be well-thought out, and we should refer to 
                  the VMS docs for ideas.
  -      0xfff8 : Shared error code, these errors can come from any origin.
   
  +The origin and shared-error stuff allows a common condition (such
  +as 'permission denied') to be used by different subsystems.  You can
  +tell by disassembling the status code just which subsystem encountered
  +the problem.  The common/private bit allows subsystems to define
  +errors specific to them.
   
   <h1>Functions</h1>
   
  
  
  
  1.1                  apache-apr/include/apr_status.h
  
  Index: apr_status.h
  ===================================================================
  /* ====================================================================
   * Copyright (c) 1999 The Apache Group.  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. All advertising materials mentioning features or use of this
   *    software must display the following acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * 4. The names "Apache Server" and "Apache Group" must not be used to
   *    endorse or promote products derived from this software without
   *    prior written permission. For written permission, please contact
   *    [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *    acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see <http://www.apache.org/>.
   *
   */
  
  #ifndef APR_STATUS_H
  #define APR_STATUS_H
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /*
   * APR status values are 32 bits wide, comprising several bit fields:
   *
   * Bits 0-2: Severity
   *  000 Warning
   *  001 Unconditional success
   *  010 Error
   *  011 Informational
   *  100 Severe/fatal error
   *  101 Reserved
   *  110 Reserved
   *  111 Reserved
   *
   * Bits 3-14: Error number (4095 possible shared errors, plus 4095 per origin)
   * Bit 15: Set if the error number is common/shared
   * Bits 16-28: Origin (facility/subsystem raising the error; 8191 possible)
   * Bits 29-31: Reserved
   */
  
  #define APR_M_SEVERITY 0x00000007
  #define APR_S_WARNING  0x0
  #define APR_S_SUCCESS  0x1
  #define APR_S_ERROR    0x2
  #define APR_S_INFO     0x3
  #define APR_S_FATAL    0x4
  
  #define APR_M_BOOLSTAT 0x00000001
  #define APR_M_ERRNUM   0x00007ff8
  #define APR_M_SHARED   0x00008000
  #define APR_M_ORIGIN   0x1fff0000
  
  #define APR_IS_SUCCESS(c) (((c) & APR_M_SEVERITY) == APR_S_SUCCESS)
  #define APR_IS_INFO(c)    (((c) & APR_M_SEVERITY) == APR_S_INFO)
  #define APR_IS_WARNING(c) (((c) & APR_M_SEVERITY) == APR_S_WARNING)
  #define APR_IS_ERROR(c)   (((c) & APR_M_SEVERITY) == APR_S_ERROR)
  #define APR_IS_FATAL(c)   (((c) & APR_M_SEVERITY) == APR_S_FATAL)
  
  #define APR_FAILED(c)     (((c) & APR_M_BOOLSTAT) == 0)
  #ifdef __cplusplus
  }
  #endif
  
  #endif        /* !APR_STATUS_H */
  
  
  

Reply via email to