Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 75527 invoked by uid 500); 1 Apr 2000 21:36:51 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk X-No-Archive: yes Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 75515 invoked from network); 1 Apr 2000 21:36:50 -0000 Date: Sat, 1 Apr 2000 16:36:43 -0500 Message-Id: <200004012136.QAA18052@k5.localdomain> X-Authentication-Warning: k5.localdomain: trawick set sender to trawickj@bellsouth.net using -f From: Jeff Trawick To: new-httpd@apache.org Subject: [PATCH] encoding of different error types in ap_status_t Reply-to: trawickj@bellsouth.net X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Some useful macros recently discussed (e.g., macro to tell if an ap_status_t value is an OS error, macro to retrieve OS error from ap_status_t) are not in this patch and should be added later. This patch should handle UNIX (handled already, really), Win32, and OS/2, and probably any other systems unless they have bizarre requirements like Win32. In addition, it fixes some bugs in the definition of APR_EHOSTNOTFOUND, APR_ENODATA, APR_ENOADDRESS, and APR_ENORECOVERY. Index: lib/apr/include/apr_errno.h =================================================================== RCS file: /cvs/apache/apache-2.0/src/lib/apr/include/apr_errno.h,v retrieving revision 1.16 diff -u -u -r1.16 apr_errno.h --- apr_errno.h 2000/03/31 08:35:55 1.16 +++ apr_errno.h 2000/04/01 21:39:26 @@ -66,11 +66,27 @@ extern "C" { #endif /* __cplusplus */ -/* Define four layers of status code offsets so that we don't interfere - * with the predefined errno codes on the operating system. Codes beyond - * APR_OS_START_USEERR are reserved for applications that use APR that - * layer their own error codes along with APR's. +typedef int ap_status_t; + +char *ap_strerror(ap_status_t status, char *buf, size_t buf_size); + +/* Define five layers of status code offsets so that we don't interfere + * with the predefined errno codes on the operating system. + * + * For platforms such as Windows and OS/2 which have OS-specific error + * codes: + * + * Codes between APR_OS_START_USEERR and APR_OS_START_OSERR are reserved + * for applications that use APR that layer their own error codes along + * with APR's. + * + * For platforms such as UNIX where the system uses errno: + * + * APR_OS_START_OSERR is not used, so codes beyond APR_OS_START_USEERR are + * reserved for applications that use APR that layer their own error codes + * along with APR's. */ + #ifndef APR_OS_START_ERROR #define APR_OS_START_ERROR 4000 #endif @@ -84,11 +100,20 @@ #define APR_OS_START_USEERR (APR_OS_START_SYSERR + 500) #endif -/* If this definition of APRStatus changes, then we can remove this, but right - * now, the decision was to use an errno-like implementation. - */ -typedef int ap_status_t; +#ifndef APR_OS_START_OSERR +#ifdef WIN32 +#define APR_OS_START_OSERR 0x20000000 +#else +#define APR_OS_START_OSERR (APR_START_USEERR + 30000) +#endif + +#endif /* WIN32 */ + +#ifndef APR_STATUS_FROM_OSERR +#define APR_STATUS_FROM_OSERR(err) ((err) + APR_OS_START_OSERR) +#endif + #define APR_SUCCESS 0 /* APR ERROR VALUES */ @@ -366,29 +391,20 @@ #define APR_EOPNOTSUPP (APR_OS_START_SYSERR + 35) #endif -#ifdef HOST_NOT_FOUND -#define APR_EHOSTNOTFOUND HOST_NOT_FOUND -#else +/* never use h_errno values as-is because doing so makes them + * indistinguishable from errno values + * APR_EHOSTNOTFOUND corresponds to HOST_NOT_FOUND + * APR_ENODATA corresponds to NO_DATA + * APR_ENOADDRESS corresponds to NO_ADDRESS + * APR_ENORECOVERY corresponds to NO_RECOVERY + */ #define APR_EHOSTNOTFOUND (APR_OS_START_SYSERR + 36) -#endif -#ifdef NO_DATA -#define APR_ENODATA NO_DATA -#else #define APR_ENODATA (APR_OS_START_SYSERR + 37) -#endif -#ifdef NO_ADDRESS -#define APR_ENOADDRESS NO_ADDRESS -#else #define APR_ENOADDRESS (APR_OS_START_SYSERR + 38) -#endif -#ifdef NO_RECOVERY -#define APR_ENORECOVERY NO_RECOVERY -#else #define APR_ENORECOVERY (APR_OS_START_SYSERR + 39) -#endif #ifdef EISCONN #define APR_EISCONN EISCONN -- Jeff Trawick | trawick@ibm.net | PGP public key at web site: http://www.geocities.com/SiliconValley/Park/9289/ Born in Roswell... married an alien...