Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_errno.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_ERRNO_H
00017 #define APR_ERRNO_H
00018 
00019 /**
00020  * @file apr_errno.h
00021  * @brief APR Error Codes
00022  */
00023 
00024 #include "apr.h"
00025 
00026 #if APR_HAVE_ERRNO_H
00027 #include <errno.h>
00028 #endif
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /* __cplusplus */
00033 
00034 /**
00035  * @defgroup apr_errno Error Codes
00036  * @ingroup APR 
00037  * @{
00038  */
00039 
00040 /**
00041  * Type for specifying an error or status code.
00042  */
00043 typedef int apr_status_t;
00044 
00045 /**
00046  * Return a human readable string describing the specified error.
00047  * @param statcode The error code the get a string for.
00048  * @param buf A buffer to hold the error string.
00049  * @param bufsize Size of the buffer to hold the string.
00050  */
00051 APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, 
00052                                  apr_size_t bufsize);
00053 
00054 #if defined(DOXYGEN)
00055 /**
00056  * @def APR_FROM_OS_ERROR(os_err_type syserr)
00057  * Fold a platform specific error into an apr_status_t code.
00058  * @return apr_status_t
00059  * @param e The platform os error code.
00060  * @warning  macro implementation; the syserr argument may be evaluated
00061  *      multiple times.
00062  */
00063 #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
00064 
00065 /**
00066  * @def APR_TO_OS_ERROR(apr_status_t statcode)
00067  * @return os_err_type
00068  * Fold an apr_status_t code back to the native platform defined error.
00069  * @param e The apr_status_t folded platform os error code.
00070  * @warning  macro implementation; the statcode argument may be evaluated
00071  *      multiple times.  If the statcode was not created by apr_get_os_error 
00072  *      or APR_FROM_OS_ERROR, the results are undefined.
00073  */
00074 #define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
00075 
00076 /** @def apr_get_os_error()
00077  * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
00078  * @remark This retrieves errno, or calls a GetLastError() style function, and
00079  *      folds it with APR_FROM_OS_ERROR.  Some platforms (such as OS2) have no
00080  *      such mechanism, so this call may be unsupported.  Do NOT use this
00081  *      call for socket errors from socket, send, recv etc!
00082  */
00083 
00084 /** @def apr_set_os_error(e)
00085  * Reset the last platform error, unfolded from an apr_status_t, on some platforms
00086  * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR()
00087  * @warning This is a macro implementation; the statcode argument may be evaluated
00088  *      multiple times.  If the statcode was not created by apr_get_os_error
00089  *      or APR_FROM_OS_ERROR, the results are undefined.  This macro sets
00090  *      errno, or calls a SetLastError() style function, unfolding statcode
00091  *      with APR_TO_OS_ERROR.  Some platforms (such as OS2) have no such
00092  *      mechanism, so this call may be unsupported.
00093  */
00094 
00095 /** @def apr_get_netos_error()
00096  * Return the last socket error, folded into apr_status_t, on all platforms
00097  * @remark This retrieves errno or calls a GetLastSocketError() style function,
00098  *      and folds it with APR_FROM_OS_ERROR.
00099  */
00100 
00101 /** @def apr_set_netos_error(e)
00102  * Reset the last socket error, unfolded from an apr_status_t
00103  * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR()
00104  * @warning This is a macro implementation; the statcode argument may be evaluated
00105  *      multiple times.  If the statcode was not created by apr_get_os_error
00106  *      or APR_FROM_OS_ERROR, the results are undefined.  This macro sets
00107  *      errno, or calls a WSASetLastError() style function, unfolding 
00108  *      socketcode with APR_TO_OS_ERROR.
00109  */
00110 
00111 #endif /* defined(DOXYGEN) */
00112 
00113 /**
00114  * APR_OS_START_ERROR is where the APR specific error values start.
00115  */
00116 #define APR_OS_START_ERROR     20000
00117 /**
00118  * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
00119  *    into one of the error/status ranges below -- except for
00120  *    APR_OS_START_USERERR, which see.
00121  */
00122 #define APR_OS_ERRSPACE_SIZE 50000
00123 /**
00124  * APR_OS_START_STATUS is where the APR specific status codes start.
00125  */
00126 #define APR_OS_START_STATUS    (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
00127 /**
00128  * APR_OS_START_USERERR are reserved for applications that use APR that
00129  *     layer their own error codes along with APR's.  Note that the
00130  *     error immediately following this one is set ten times farther
00131  *     away than usual, so that users of apr have a lot of room in
00132  *     which to declare custom error codes.
00133  */
00134 #define APR_OS_START_USERERR    (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
00135 /**
00136  * APR_OS_START_USEERR is obsolete, defined for compatibility only.
00137  * Use APR_OS_START_USERERR instead.
00138  */
00139 #define APR_OS_START_USEERR     APR_OS_START_USERERR
00140 /**
00141  * APR_OS_START_CANONERR is where APR versions of errno values are defined
00142  *     on systems which don't have the corresponding errno.
00143  */
00144 #define APR_OS_START_CANONERR  (APR_OS_START_USERERR \
00145                                  + (APR_OS_ERRSPACE_SIZE * 10))
00146 /**
00147  * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into 
00148  *     apr_status_t values.
00149  */
00150 #define APR_OS_START_EAIERR    (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
00151 /**
00152  * APR_OS_START_SYSERR folds platform-specific system error values into 
00153  *     apr_status_t values.
00154  */
00155 #define APR_OS_START_SYSERR    (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
00156 
00157 /** no error. */
00158 #define APR_SUCCESS 0
00159 
00160 /** 
00161  * @defgroup APR_Error APR Error Values
00162  * <PRE>
00163  * <b>APR ERROR VALUES</b>
00164  * APR_ENOSTAT      APR was unable to perform a stat on the file 
00165  * APR_ENOPOOL      APR was not provided a pool with which to allocate memory
00166  * APR_EBADDATE     APR was given an invalid date 
00167  * APR_EINVALSOCK   APR was given an invalid socket
00168  * APR_ENOPROC      APR was not given a process structure
00169  * APR_ENOTIME      APR was not given a time structure
00170  * APR_ENODIR       APR was not given a directory structure
00171  * APR_ENOLOCK      APR was not given a lock structure
00172  * APR_ENOPOLL      APR was not given a poll structure
00173  * APR_ENOSOCKET    APR was not given a socket
00174  * APR_ENOTHREAD    APR was not given a thread structure
00175  * APR_ENOTHDKEY    APR was not given a thread key structure
00176  * APR_ENOSHMAVAIL  There is no more shared memory available
00177  * APR_EDSOOPEN     APR was unable to open the dso object.  For more 
00178  *                  information call apr_dso_error().
00179  * APR_EGENERAL     General failure (specific information not available)
00180  * APR_EBADIP       The specified IP address is invalid
00181  * APR_EBADMASK     The specified netmask is invalid
00182  * APR_ESYMNOTFOUND Could not find the requested symbol
00183  * </PRE>
00184  *
00185  * <PRE>
00186  * <b>APR STATUS VALUES</b>
00187  * APR_INCHILD        Program is currently executing in the child
00188  * APR_INPARENT       Program is currently executing in the parent
00189  * APR_DETACH         The thread is detached
00190  * APR_NOTDETACH      The thread is not detached
00191  * APR_CHILD_DONE     The child has finished executing
00192  * APR_CHILD_NOTDONE  The child has not finished executing
00193  * APR_TIMEUP         The operation did not finish before the timeout
00194  * APR_INCOMPLETE     The operation was incomplete although some processing
00195  *                    was performed and the results are partially valid
00196  * APR_BADCH          Getopt found an option not in the option string
00197  * APR_BADARG         Getopt found an option that is missing an argument 
00198  *                    and an argument was specified in the option string
00199  * APR_EOF            APR has encountered the end of the file
00200  * APR_NOTFOUND       APR was unable to find the socket in the poll structure
00201  * APR_ANONYMOUS      APR is using anonymous shared memory
00202  * APR_FILEBASED      APR is using a file name as the key to the shared memory
00203  * APR_KEYBASED       APR is using a shared key as the key to the shared memory
00204  * APR_EINIT          Ininitalizer value.  If no option has been found, but 
00205  *                    the status variable requires a value, this should be used
00206  * APR_ENOTIMPL       The APR function has not been implemented on this 
00207  *                    platform, either because nobody has gotten to it yet, 
00208  *                    or the function is impossible on this platform.
00209  * APR_EMISMATCH      Two passwords do not match.
00210  * APR_EABSOLUTE      The given path was absolute.
00211  * APR_ERELATIVE      The given path was relative.
00212  * APR_EINCOMPLETE    The given path was neither relative nor absolute.
00213  * APR_EABOVEROOT     The given path was above the root path.
00214  * APR_EBUSY          The given lock was busy.
00215  * APR_EPROC_UNKNOWN  The given process wasn't recognized by APR
00216  * </PRE>
00217  * @{
00218  */
00219 /** @see APR_STATUS_IS_ENOSTAT */
00220 #define APR_ENOSTAT        (APR_OS_START_ERROR + 1)
00221 /** @see APR_STATUS_IS_ENOPOOL */
00222 #define APR_ENOPOOL        (APR_OS_START_ERROR + 2)
00223 /* empty slot: +3 */
00224 /** @see APR_STATUS_IS_EBADDATE */
00225 #define APR_EBADDATE       (APR_OS_START_ERROR + 4)
00226 /** @see APR_STATUS_IS_EINVALSOCK */
00227 #define APR_EINVALSOCK     (APR_OS_START_ERROR + 5)
00228 /** @see APR_STATUS_IS_ENOPROC */
00229 #define APR_ENOPROC        (APR_OS_START_ERROR + 6)
00230 /** @see APR_STATUS_IS_ENOTIME */
00231 #define APR_ENOTIME        (APR_OS_START_ERROR + 7)
00232 /** @see APR_STATUS_IS_ENODIR */
00233 #define APR_ENODIR         (APR_OS_START_ERROR + 8)
00234 /** @see APR_STATUS_IS_ENOLOCK */
00235 #define APR_ENOLOCK        (APR_OS_START_ERROR + 9)
00236 /** @see APR_STATUS_IS_ENOPOLL */
00237 #define APR_ENOPOLL        (APR_OS_START_ERROR + 10)
00238 /** @see APR_STATUS_IS_ENOSOCKET */
00239 #define APR_ENOSOCKET      (APR_OS_START_ERROR + 11)
00240 /** @see APR_STATUS_IS_ENOTHREAD */
00241 #define APR_ENOTHREAD      (APR_OS_START_ERROR + 12)
00242 /** @see APR_STATUS_IS_ENOTHDKEY */
00243 #define APR_ENOTHDKEY      (APR_OS_START_ERROR + 13)
00244 /** @see APR_STATUS_IS_EGENERAL */
00245 #define APR_EGENERAL       (APR_OS_START_ERROR + 14)
00246 /** @see APR_STATUS_IS_ENOSHMAVAIL */
00247 #define APR_ENOSHMAVAIL    (APR_OS_START_ERROR + 15)
00248 /** @see APR_STATUS_IS_EBADIP */
00249 #define APR_EBADIP         (APR_OS_START_ERROR + 16)
00250 /** @see APR_STATUS_IS_EBADMASK */
00251 #define APR_EBADMASK       (APR_OS_START_ERROR + 17)
00252 /* empty slot: +18 */
00253 /** @see APR_STATUS_IS_EDSOPEN */
00254 #define APR_EDSOOPEN       (APR_OS_START_ERROR + 19)
00255 /** @see APR_STATUS_IS_EABSOLUTE */
00256 #define APR_EABSOLUTE      (APR_OS_START_ERROR + 20)
00257 /** @see APR_STATUS_IS_ERELATIVE */
00258 #define APR_ERELATIVE      (APR_OS_START_ERROR + 21)
00259 /** @see APR_STATUS_IS_EINCOMPLETE */
00260 #define APR_EINCOMPLETE    (APR_OS_START_ERROR + 22)
00261 /** @see APR_STATUS_IS_EABOVEROOT */
00262 #define APR_EABOVEROOT     (APR_OS_START_ERROR + 23)
00263 /** @see APR_STATUS_IS_EBADPATH */
00264 #define APR_EBADPATH       (APR_OS_START_ERROR + 24)
00265 /** @see APR_STATUS_IS_EPATHWILD */
00266 #define APR_EPATHWILD      (APR_OS_START_ERROR + 25)
00267 /** @see APR_STATUS_IS_ESYMNOTFOUND */
00268 #define APR_ESYMNOTFOUND   (APR_OS_START_ERROR + 26)
00269 /** @see APR_STATUS_IS_EPROC_UNKNOWN */
00270 #define APR_EPROC_UNKNOWN  (APR_OS_START_ERROR + 27)
00271 /** @see APR_STATUS_IS_ENOTENOUGHENTROPY */
00272 #define APR_ENOTENOUGHENTROPY (APR_OS_START_ERROR + 28)
00273 /** @} */
00274 
00275 /** 
00276  * @defgroup APR_STATUS_IS Status Value Tests
00277  * @warning For any particular error condition, more than one of these tests
00278  *      may match. This is because platform-specific error codes may not
00279  *      always match the semantics of the POSIX codes these tests (and the
00280  *      corresponding APR error codes) are named after. A notable example
00281  *      are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
00282  *      Win32 platforms. The programmer should always be aware of this and
00283  *      adjust the order of the tests accordingly.
00284  * @{
00285  */
00286 /** 
00287  * APR was unable to perform a stat on the file 
00288  * @warning always use this test, as platform-specific variances may meet this
00289  * more than one error code 
00290  */
00291 #define APR_STATUS_IS_ENOSTAT(s)        ((s) == APR_ENOSTAT)
00292 /** 
00293  * APR was not provided a pool with which to allocate memory 
00294  * @warning always use this test, as platform-specific variances may meet this
00295  * more than one error code 
00296  */
00297 #define APR_STATUS_IS_ENOPOOL(s)        ((s) == APR_ENOPOOL)
00298 /** APR was given an invalid date  */
00299 #define APR_STATUS_IS_EBADDATE(s)       ((s) == APR_EBADDATE)
00300 /** APR was given an invalid socket */
00301 #define APR_STATUS_IS_EINVALSOCK(s)     ((s) == APR_EINVALSOCK)
00302 /** APR was not given a process structure */
00303 #define APR_STATUS_IS_ENOPROC(s)        ((s) == APR_ENOPROC)
00304 /** APR was not given a time structure */
00305 #define APR_STATUS_IS_ENOTIME(s)        ((s) == APR_ENOTIME)
00306 /** APR was not given a directory structure */
00307 #define APR_STATUS_IS_ENODIR(s)         ((s) == APR_ENODIR)
00308 /** APR was not given a lock structure */
00309 #define APR_STATUS_IS_ENOLOCK(s)        ((s) == APR_ENOLOCK)
00310 /** APR was not given a poll structure */
00311 #define APR_STATUS_IS_ENOPOLL(s)        ((s) == APR_ENOPOLL)
00312 /** APR was not given a socket */
00313 #define APR_STATUS_IS_ENOSOCKET(s)      ((s) == APR_ENOSOCKET)
00314 /** APR was not given a thread structure */
00315 #define APR_STATUS_IS_ENOTHREAD(s)      ((s) == APR_ENOTHREAD)
00316 /** APR was not given a thread key structure */
00317 #define APR_STATUS_IS_ENOTHDKEY(s)      ((s) == APR_ENOTHDKEY)
00318 /** Generic Error which can not be put into another spot */
00319 #define APR_STATUS_IS_EGENERAL(s)       ((s) == APR_EGENERAL)
00320 /** There is no more shared memory available */
00321 #define APR_STATUS_IS_ENOSHMAVAIL(s)    ((s) == APR_ENOSHMAVAIL)
00322 /** The specified IP address is invalid */
00323 #define APR_STATUS_IS_EBADIP(s)         ((s) == APR_EBADIP)
00324 /** The specified netmask is invalid */
00325 #define APR_STATUS_IS_EBADMASK(s)       ((s) == APR_EBADMASK)
00326 /* empty slot: +18 */
00327 /** 
00328  * APR was unable to open the dso object.  
00329  * For more information call apr_dso_error().
00330  */
00331 #if defined(WIN32)
00332 #define APR_STATUS_IS_EDSOOPEN(s)       ((s) == APR_EDSOOPEN \
00333                        || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
00334 #else
00335 #define APR_STATUS_IS_EDSOOPEN(s)       ((s) == APR_EDSOOPEN)
00336 #endif
00337 /** The given path was absolute. */
00338 #define APR_STATUS_IS_EABSOLUTE(s)      ((s) == APR_EABSOLUTE)
00339 /** The given path was relative. */
00340 #define APR_STATUS_IS_ERELATIVE(s)      ((s) == APR_ERELATIVE)
00341 /** The given path was neither relative nor absolute. */
00342 #define APR_STATUS_IS_EINCOMPLETE(s)    ((s) == APR_EINCOMPLETE)
00343 /** The given path was above the root path. */
00344 #define APR_STATUS_IS_EABOVEROOT(s)     ((s) == APR_EABOVEROOT)
00345 /** The given path was bad. */
00346 #define APR_STATUS_IS_EBADPATH(s)       ((s) == APR_EBADPATH)
00347 /** The given path contained wildcards. */
00348 #define APR_STATUS_IS_EPATHWILD(s)      ((s) == APR_EPATHWILD)
00349 /** Could not find the requested symbol.
00350  * For more information call apr_dso_error().
00351  */
00352 #if defined(WIN32)
00353 #define APR_STATUS_IS_ESYMNOTFOUND(s)   ((s) == APR_ESYMNOTFOUND \
00354                        || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
00355 #else
00356 #define APR_STATUS_IS_ESYMNOTFOUND(s)   ((s) == APR_ESYMNOTFOUND)
00357 #endif
00358 /** The given process was not recognized by APR. */
00359 #define APR_STATUS_IS_EPROC_UNKNOWN(s)  ((s) == APR_EPROC_UNKNOWN)
00360 
00361 /** APR could not gather enough entropy to continue. */
00362 #define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
00363 
00364 /** @} */
00365 
00366 /** 
00367  * @addtogroup APR_Error
00368  * @{
00369  */
00370 /** @see APR_STATUS_IS_INCHILD */
00371 #define APR_INCHILD        (APR_OS_START_STATUS + 1)
00372 /** @see APR_STATUS_IS_INPARENT */
00373 #define APR_INPARENT       (APR_OS_START_STATUS + 2)
00374 /** @see APR_STATUS_IS_DETACH */
00375 #define APR_DETACH         (APR_OS_START_STATUS + 3)
00376 /** @see APR_STATUS_IS_NOTDETACH */
00377 #define APR_NOTDETACH      (APR_OS_START_STATUS + 4)
00378 /** @see APR_STATUS_IS_CHILD_DONE */
00379 #define APR_CHILD_DONE     (APR_OS_START_STATUS + 5)
00380 /** @see APR_STATUS_IS_CHILD_NOTDONE */
00381 #define APR_CHILD_NOTDONE  (APR_OS_START_STATUS + 6)
00382 /** @see APR_STATUS_IS_TIMEUP */
00383 #define APR_TIMEUP         (APR_OS_START_STATUS + 7)
00384 /** @see APR_STATUS_IS_INCOMPLETE */
00385 #define APR_INCOMPLETE     (APR_OS_START_STATUS + 8)
00386 /* empty slot: +9 */
00387 /* empty slot: +10 */
00388 /* empty slot: +11 */
00389 /** @see APR_STATUS_IS_BADCH */
00390 #define APR_BADCH          (APR_OS_START_STATUS + 12)
00391 /** @see APR_STATUS_IS_BADARG */
00392 #define APR_BADARG         (APR_OS_START_STATUS + 13)
00393 /** @see APR_STATUS_IS_EOF */
00394 #define APR_EOF            (APR_OS_START_STATUS + 14)
00395 /** @see APR_STATUS_IS_NOTFOUND */
00396 #define APR_NOTFOUND       (APR_OS_START_STATUS + 15)
00397 /* empty slot: +16 */
00398 /* empty slot: +17 */
00399 /* empty slot: +18 */
00400 /** @see APR_STATUS_IS_ANONYMOUS */
00401 #define APR_ANONYMOUS      (APR_OS_START_STATUS + 19)
00402 /** @see APR_STATUS_IS_FILEBASED */
00403 #define APR_FILEBASED      (APR_OS_START_STATUS + 20)
00404 /** @see APR_STATUS_IS_KEYBASED */
00405 #define APR_KEYBASED       (APR_OS_START_STATUS + 21)
00406 /** @see APR_STATUS_IS_EINIT */
00407 #define APR_EINIT          (APR_OS_START_STATUS + 22)  
00408 /** @see APR_STATUS_IS_ENOTIMPL */
00409 #define APR_ENOTIMPL       (APR_OS_START_STATUS + 23)
00410 /** @see APR_STATUS_IS_EMISMATCH */
00411 #define APR_EMISMATCH      (APR_OS_START_STATUS + 24)
00412 /** @see APR_STATUS_IS_EBUSY */
00413 #define APR_EBUSY          (APR_OS_START_STATUS + 25)
00414 /** @} */
00415 
00416 /** 
00417  * @addtogroup APR_STATUS_IS
00418  * @{
00419  */
00420 /** 
00421  * Program is currently executing in the child 
00422  * @warning
00423  * always use this test, as platform-specific variances may meet this
00424  * more than one error code */
00425 #define APR_STATUS_IS_INCHILD(s)        ((s) == APR_INCHILD)
00426 /** 
00427  * Program is currently executing in the parent 
00428  * @warning
00429  * always use this test, as platform-specific variances may meet this
00430  * more than one error code 
00431  */
00432 #define APR_STATUS_IS_INPARENT(s)       ((s) == APR_INPARENT)
00433 /** 
00434  * The thread is detached 
00435  * @warning
00436  * always use this test, as platform-specific variances may meet this
00437  * more than one error code 
00438  */
00439 #define APR_STATUS_IS_DETACH(s)         ((s) == APR_DETACH)
00440 /** 
00441  * The thread is not detached 
00442  * @warning
00443  * always use this test, as platform-specific variances may meet this
00444  * more than one error code 
00445  */
00446 #define APR_STATUS_IS_NOTDETACH(s)      ((s) == APR_NOTDETACH)
00447 /** 
00448  * The child has finished executing
00449  * @warning
00450  * always use this test, as platform-specific variances may meet this
00451  * more than one error code 
00452  */
00453 #define APR_STATUS_IS_CHILD_DONE(s)     ((s) == APR_CHILD_DONE)
00454 /** 
00455  * The child has not finished executing
00456  * @warning
00457  * always use this test, as platform-specific variances may meet this
00458  * more than one error code 
00459  */
00460 #define APR_STATUS_IS_CHILD_NOTDONE(s)  ((s) == APR_CHILD_NOTDONE)
00461 /** 
00462  * The operation did not finish before the timeout
00463  * @warning
00464  * always use this test, as platform-specific variances may meet this
00465  * more than one error code 
00466  */
00467 #define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP)
00468 /** 
00469  * The character conversion stopped because of an incomplete character or 
00470  * shift sequence at the end  of the input buffer.
00471  * @warning
00472  * always use this test, as platform-specific variances may meet this
00473  * more than one error code 
00474  */
00475 #define APR_STATUS_IS_INCOMPLETE(s)     ((s) == APR_INCOMPLETE)
00476 /* empty slot: +9 */
00477 /* empty slot: +10 */
00478 /* empty slot: +11 */
00479 /** 
00480  * Getopt found an option not in the option string
00481  * @warning
00482  * always use this test, as platform-specific variances may meet this
00483  * more than one error code 
00484  */
00485 #define APR_STATUS_IS_BADCH(s)          ((s) == APR_BADCH)
00486 /** 
00487  * Getopt found an option not in the option string and an argument was 
00488  * specified in the option string
00489  * @warning
00490  * always use this test, as platform-specific variances may meet this
00491  * more than one error code 
00492  */
00493 #define APR_STATUS_IS_BADARG(s)         ((s) == APR_BADARG)
00494 /** 
00495  * APR has encountered the end of the file
00496  * @warning
00497  * always use this test, as platform-specific variances may meet this
00498  * more than one error code 
00499  */
00500 #define APR_STATUS_IS_EOF(s)            ((s) == APR_EOF)
00501 /** 
00502  * APR was unable to find the socket in the poll structure
00503  * @warning
00504  * always use this test, as platform-specific variances may meet this
00505  * more than one error code 
00506  */
00507 #define APR_STATUS_IS_NOTFOUND(s)       ((s) == APR_NOTFOUND)
00508 /* empty slot: +16 */
00509 /* empty slot: +17 */
00510 /* empty slot: +18 */
00511 /** 
00512  * APR is using anonymous shared memory
00513  * @warning
00514  * always use this test, as platform-specific variances may meet this
00515  * more than one error code 
00516  */
00517 #define APR_STATUS_IS_ANONYMOUS(s)      ((s) == APR_ANONYMOUS)
00518 /** 
00519  * APR is using a file name as the key to the shared memory
00520  * @warning
00521  * always use this test, as platform-specific variances may meet this
00522  * more than one error code 
00523  */
00524 #define APR_STATUS_IS_FILEBASED(s)      ((s) == APR_FILEBASED)
00525 /** 
00526  * APR is using a shared key as the key to the shared memory
00527  * @warning
00528  * always use this test, as platform-specific variances may meet this
00529  * more than one error code 
00530  */
00531 #define APR_STATUS_IS_KEYBASED(s)       ((s) == APR_KEYBASED)
00532 /** 
00533  * Ininitalizer value.  If no option has been found, but 
00534  * the status variable requires a value, this should be used
00535  * @warning
00536  * always use this test, as platform-specific variances may meet this
00537  * more than one error code 
00538  */
00539 #define APR_STATUS_IS_EINIT(s)          ((s) == APR_EINIT)
00540 /** 
00541  * The APR function has not been implemented on this 
00542  * platform, either because nobody has gotten to it yet, 
00543  * or the function is impossible on this platform.
00544  * @warning
00545  * always use this test, as platform-specific variances may meet this
00546  * more than one error code 
00547  */
00548 #define APR_STATUS_IS_ENOTIMPL(s)       ((s) == APR_ENOTIMPL)
00549 /** 
00550  * Two passwords do not match.
00551  * @warning
00552  * always use this test, as platform-specific variances may meet this
00553  * more than one error code 
00554  */
00555 #define APR_STATUS_IS_EMISMATCH(s)      ((s) == APR_EMISMATCH)
00556 /** 
00557  * The given lock was busy
00558  * @warning always use this test, as platform-specific variances may meet this
00559  * more than one error code 
00560  */
00561 #define APR_STATUS_IS_EBUSY(s)          ((s) == APR_EBUSY)
00562 
00563 /** @} */
00564 
00565 /** 
00566  * @addtogroup APR_Error APR Error Values
00567  * @{
00568  */
00569 /* APR CANONICAL ERROR VALUES */
00570 /** @see APR_STATUS_IS_EACCES */
00571 #ifdef EACCES
00572 #define APR_EACCES EACCES
00573 #else
00574 #define APR_EACCES         (APR_OS_START_CANONERR + 1)
00575 #endif
00576 
00577 /** @see APR_STATUS_IS_EXIST */
00578 #ifdef EEXIST
00579 #define APR_EEXIST EEXIST
00580 #else
00581 #define APR_EEXIST         (APR_OS_START_CANONERR + 2)
00582 #endif
00583 
00584 /** @see APR_STATUS_IS_ENAMETOOLONG */
00585 #ifdef ENAMETOOLONG
00586 #define APR_ENAMETOOLONG ENAMETOOLONG
00587 #else
00588 #define APR_ENAMETOOLONG   (APR_OS_START_CANONERR + 3)
00589 #endif
00590 
00591 /** @see APR_STATUS_IS_ENOENT */
00592 #ifdef ENOENT
00593 #define APR_ENOENT ENOENT
00594 #else
00595 #define APR_ENOENT         (APR_OS_START_CANONERR + 4)
00596 #endif
00597 
00598 /** @see APR_STATUS_IS_ENOTDIR */
00599 #ifdef ENOTDIR
00600 #define APR_ENOTDIR ENOTDIR
00601 #else
00602 #define APR_ENOTDIR        (APR_OS_START_CANONERR + 5)
00603 #endif
00604 
00605 /** @see APR_STATUS_IS_ENOSPC */
00606 #ifdef ENOSPC
00607 #define APR_ENOSPC ENOSPC
00608 #else
00609 #define APR_ENOSPC         (APR_OS_START_CANONERR + 6)
00610 #endif
00611 
00612 /** @see APR_STATUS_IS_ENOMEM */
00613 #ifdef ENOMEM
00614 #define APR_ENOMEM ENOMEM
00615 #else
00616 #define APR_ENOMEM         (APR_OS_START_CANONERR + 7)
00617 #endif
00618 
00619 /** @see APR_STATUS_IS_EMFILE */
00620 #ifdef EMFILE
00621 #define APR_EMFILE EMFILE
00622 #else
00623 #define APR_EMFILE         (APR_OS_START_CANONERR + 8)
00624 #endif
00625 
00626 /** @see APR_STATUS_IS_ENFILE */
00627 #ifdef ENFILE
00628 #define APR_ENFILE ENFILE
00629 #else
00630 #define APR_ENFILE         (APR_OS_START_CANONERR + 9)
00631 #endif
00632 
00633 /** @see APR_STATUS_IS_EBADF */
00634 #ifdef EBADF
00635 #define APR_EBADF EBADF
00636 #else
00637 #define APR_EBADF          (APR_OS_START_CANONERR + 10)
00638 #endif
00639 
00640 /** @see APR_STATUS_IS_EINVAL */
00641 #ifdef EINVAL
00642 #define APR_EINVAL EINVAL
00643 #else
00644 #define APR_EINVAL         (APR_OS_START_CANONERR + 11)
00645 #endif
00646 
00647 /** @see APR_STATUS_IS_ESPIPE */
00648 #ifdef ESPIPE
00649 #define APR_ESPIPE ESPIPE
00650 #else
00651 #define APR_ESPIPE         (APR_OS_START_CANONERR + 12)
00652 #endif
00653 
00654 /** 
00655  * @see APR_STATUS_IS_EAGAIN 
00656  * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
00657  */
00658 #ifdef EAGAIN
00659 #define APR_EAGAIN EAGAIN
00660 #elif defined(EWOULDBLOCK)
00661 #define APR_EAGAIN EWOULDBLOCK
00662 #else
00663 #define APR_EAGAIN         (APR_OS_START_CANONERR + 13)
00664 #endif
00665 
00666 /** @see APR_STATUS_IS_EINTR */
00667 #ifdef EINTR
00668 #define APR_EINTR EINTR
00669 #else
00670 #define APR_EINTR          (APR_OS_START_CANONERR + 14)
00671 #endif
00672 
00673 /** @see APR_STATUS_IS_ENOTSOCK */
00674 #ifdef ENOTSOCK
00675 #define APR_ENOTSOCK ENOTSOCK
00676 #else
00677 #define APR_ENOTSOCK       (APR_OS_START_CANONERR + 15)
00678 #endif
00679 
00680 /** @see APR_STATUS_IS_ECONNREFUSED */
00681 #ifdef ECONNREFUSED
00682 #define APR_ECONNREFUSED ECONNREFUSED
00683 #else
00684 #define APR_ECONNREFUSED   (APR_OS_START_CANONERR + 16)
00685 #endif
00686 
00687 /** @see APR_STATUS_IS_EINPROGRESS */
00688 #ifdef EINPROGRESS
00689 #define APR_EINPROGRESS EINPROGRESS
00690 #else
00691 #define APR_EINPROGRESS    (APR_OS_START_CANONERR + 17)
00692 #endif
00693 
00694 /** 
00695  * @see APR_STATUS_IS_ECONNABORTED
00696  * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
00697  */
00698 
00699 #ifdef ECONNABORTED
00700 #define APR_ECONNABORTED ECONNABORTED
00701 #else
00702 #define APR_ECONNABORTED   (APR_OS_START_CANONERR + 18)
00703 #endif
00704 
00705 /** @see APR_STATUS_IS_ECONNRESET */
00706 #ifdef ECONNRESET
00707 #define APR_ECONNRESET ECONNRESET
00708 #else
00709 #define APR_ECONNRESET     (APR_OS_START_CANONERR + 19)
00710 #endif
00711 
00712 /** @see APR_STATUS_IS_ETIMEDOUT 
00713  *  @deprecated */
00714 #ifdef ETIMEDOUT
00715 #define APR_ETIMEDOUT ETIMEDOUT
00716 #else
00717 #define APR_ETIMEDOUT      (APR_OS_START_CANONERR + 20)
00718 #endif
00719 
00720 /** @see APR_STATUS_IS_EHOSTUNREACH */
00721 #ifdef EHOSTUNREACH
00722 #define APR_EHOSTUNREACH EHOSTUNREACH
00723 #else
00724 #define APR_EHOSTUNREACH   (APR_OS_START_CANONERR + 21)
00725 #endif
00726 
00727 /** @see APR_STATUS_IS_ENETUNREACH */
00728 #ifdef ENETUNREACH
00729 #define APR_ENETUNREACH ENETUNREACH
00730 #else
00731 #define APR_ENETUNREACH    (APR_OS_START_CANONERR + 22)
00732 #endif
00733 
00734 /** @see APR_STATUS_IS_EFTYPE */
00735 #ifdef EFTYPE
00736 #define APR_EFTYPE EFTYPE
00737 #else
00738 #define APR_EFTYPE        (APR_OS_START_CANONERR + 23)
00739 #endif
00740 
00741 /** @see APR_STATUS_IS_EPIPE */
00742 #ifdef EPIPE
00743 #define APR_EPIPE EPIPE
00744 #else
00745 #define APR_EPIPE         (APR_OS_START_CANONERR + 24)
00746 #endif
00747 
00748 /** @see APR_STATUS_IS_EXDEV */
00749 #ifdef EXDEV
00750 #define APR_EXDEV EXDEV
00751 #else
00752 #define APR_EXDEV         (APR_OS_START_CANONERR + 25)
00753 #endif
00754 
00755 /** @see APR_STATUS_IS_ENOTEMPTY */
00756 #ifdef ENOTEMPTY
00757 #define APR_ENOTEMPTY ENOTEMPTY
00758 #else
00759 #define APR_ENOTEMPTY     (APR_OS_START_CANONERR + 26)
00760 #endif
00761 
00762 /** @} */
00763 
00764 #if defined(OS2) && !defined(DOXYGEN)
00765 
00766 #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
00767 #define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
00768 
00769 #define INCL_DOSERRORS
00770 #define INCL_DOS
00771 
00772 /* Leave these undefined.
00773  * OS2 doesn't rely on the errno concept.
00774  * The API calls always return a result codes which
00775  * should be filtered through APR_FROM_OS_ERROR().
00776  *
00777  * #define apr_get_os_error()   (APR_FROM_OS_ERROR(GetLastError()))
00778  * #define apr_set_os_error(e)  (SetLastError(APR_TO_OS_ERROR(e)))
00779  */
00780 
00781 /* A special case, only socket calls require this;
00782  */
00783 #define apr_get_netos_error()   (APR_FROM_OS_ERROR(errno))
00784 #define apr_set_netos_error(e)  (errno = APR_TO_OS_ERROR(e))
00785 
00786 /* And this needs to be greped away for good:
00787  */
00788 #define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
00789 
00790 /* These can't sit in a private header, so in spite of the extra size, 
00791  * they need to be made available here.
00792  */
00793 #define SOCBASEERR              10000
00794 #define SOCEPERM                (SOCBASEERR+1)             /* Not owner */
00795 #define SOCESRCH                (SOCBASEERR+3)             /* No such process */
00796 #define SOCEINTR                (SOCBASEERR+4)             /* Interrupted system call */
00797 #define SOCENXIO                (SOCBASEERR+6)             /* No such device or address */
00798 #define SOCEBADF                (SOCBASEERR+9)             /* Bad file number */
00799 #define SOCEACCES               (SOCBASEERR+13)            /* Permission denied */
00800 #define SOCEFAULT               (SOCBASEERR+14)            /* Bad address */
00801 #define SOCEINVAL               (SOCBASEERR+22)            /* Invalid argument */
00802 #define SOCEMFILE               (SOCBASEERR+24)            /* Too many open files */
00803 #define SOCEPIPE                (SOCBASEERR+32)            /* Broken pipe */
00804 #define SOCEOS2ERR              (SOCBASEERR+100)           /* OS/2 Error */
00805 #define SOCEWOULDBLOCK          (SOCBASEERR+35)            /* Operation would block */
00806 #define SOCEINPROGRESS          (SOCBASEERR+36)            /* Operation now in progress */
00807 #define SOCEALREADY             (SOCBASEERR+37)            /* Operation already in progress */
00808 #define SOCENOTSOCK             (SOCBASEERR+38)            /* Socket operation on non-socket */
00809 #define SOCEDESTADDRREQ         (SOCBASEERR+39)            /* Destination address required */
00810 #define SOCEMSGSIZE             (SOCBASEERR+40)            /* Message too long */
00811 #define SOCEPROTOTYPE           (SOCBASEERR+41)            /* Protocol wrong type for socket */
00812 #define SOCENOPROTOOPT          (SOCBASEERR+42)            /* Protocol not available */
00813 #define SOCEPROTONOSUPPORT      (SOCBASEERR+43)            /* Protocol not supported */
00814 #define SOCESOCKTNOSUPPORT      (SOCBASEERR+44)            /* Socket type not supported */
00815 #define SOCEOPNOTSUPP           (SOCBASEERR+45)            /* Operation not supported on socket */
00816 #define SOCEPFNOSUPPORT         (SOCBASEERR+46)            /* Protocol family not supported */
00817 #define SOCEAFNOSUPPORT         (SOCBASEERR+47)            /* Address family not supported by protocol family */
00818 #define SOCEADDRINUSE           (SOCBASEERR+48)            /* Address already in use */
00819 #define SOCEADDRNOTAVAIL        (SOCBASEERR+49)            /* Can't assign requested address */
00820 #define SOCENETDOWN             (SOCBASEERR+50)            /* Network is down */
00821 #define SOCENETUNREACH          (SOCBASEERR+51)            /* Network is unreachable */
00822 #define SOCENETRESET            (SOCBASEERR+52)            /* Network dropped connection on reset */
00823 #define SOCECONNABORTED         (SOCBASEERR+53)            /* Software caused connection abort */
00824 #define SOCECONNRESET           (SOCBASEERR+54)            /* Connection reset by peer */
00825 #define SOCENOBUFS              (SOCBASEERR+55)            /* No buffer space available */
00826 #define SOCEISCONN              (SOCBASEERR+56)            /* Socket is already connected */
00827 #define SOCENOTCONN             (SOCBASEERR+57)            /* Socket is not connected */
00828 #define SOCESHUTDOWN            (SOCBASEERR+58)            /* Can't send after socket shutdown */
00829 #define SOCETOOMANYREFS         (SOCBASEERR+59)            /* Too many references: can't splice */
00830 #define SOCETIMEDOUT            (SOCBASEERR+60)            /* Connection timed out */
00831 #define SOCECONNREFUSED         (SOCBASEERR+61)            /* Connection refused */
00832 #define SOCELOOP                (SOCBASEERR+62)            /* Too many levels of symbolic links */
00833 #define SOCENAMETOOLONG         (SOCBASEERR+63)            /* File name too long */
00834 #define SOCEHOSTDOWN            (SOCBASEERR+64)            /* Host is down */
00835 #define SOCEHOSTUNREACH         (SOCBASEERR+65)            /* No route to host */
00836 #define SOCENOTEMPTY            (SOCBASEERR+66)            /* Directory not empty */
00837 
00838 /* APR CANONICAL ERROR TESTS */
00839 #define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES \
00840                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
00841                 || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
00842 #define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST \
00843                 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
00844                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
00845                 || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
00846                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
00847 #define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG \
00848                 || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
00849                 || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
00850 #define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
00851                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
00852                 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
00853                 || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
00854                 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
00855 #define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
00856 #define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
00857                 || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
00858 #define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
00859 #define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE \
00860                 || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
00861 #define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
00862 #define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF \
00863                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
00864 #define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL \
00865                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
00866                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
00867 #define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE \
00868                 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
00869 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
00870                 || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
00871                 || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
00872                 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
00873 #define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
00874                 || (s) == APR_OS_START_SYSERR + SOCEINTR)
00875 #define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
00876                 || (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
00877 #define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
00878                 || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
00879 #define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
00880                 || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
00881 #define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
00882                 || (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
00883 #define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
00884                 || (s) == APR_OS_START_SYSERR + SOCECONNRESET)
00885 // XXX deprecated
00886 #define APR_STATUS_IS_ETIMEDOUT(s)         ((s) == APR_ETIMEDOUT \
00887                 || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)    
00888 #undef APR_STATUS_IS_TIMEUP
00889 #define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
00890                 || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)    
00891 #define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
00892                 || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
00893 #define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
00894                 || (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
00895 #define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE)
00896 #define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE \
00897                 || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
00898                 || (s) == APR_OS_START_SYSERR + SOCEPIPE)
00899 #define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV \
00900                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
00901 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
00902                 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
00903                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
00904 
00905 /*
00906     Sorry, too tired to wrap this up for OS2... feel free to
00907     fit the following into their best matches.
00908 
00909     { ERROR_NO_SIGNAL_SENT,     ESRCH           },
00910     { SOCEALREADY,              EALREADY        },
00911     { SOCEDESTADDRREQ,          EDESTADDRREQ    },
00912     { SOCEMSGSIZE,              EMSGSIZE        },
00913     { SOCEPROTOTYPE,            EPROTOTYPE      },
00914     { SOCENOPROTOOPT,           ENOPROTOOPT     },
00915     { SOCEPROTONOSUPPORT,       EPROTONOSUPPORT },
00916     { SOCESOCKTNOSUPPORT,       ESOCKTNOSUPPORT },
00917     { SOCEOPNOTSUPP,            EOPNOTSUPP      },
00918     { SOCEPFNOSUPPORT,          EPFNOSUPPORT    },
00919     { SOCEAFNOSUPPORT,          EAFNOSUPPORT    },
00920     { SOCEADDRINUSE,            EADDRINUSE      },
00921     { SOCEADDRNOTAVAIL,         EADDRNOTAVAIL   },
00922     { SOCENETDOWN,              ENETDOWN        },
00923     { SOCENETRESET,             ENETRESET       },
00924     { SOCENOBUFS,               ENOBUFS         },
00925     { SOCEISCONN,               EISCONN         },
00926     { SOCENOTCONN,              ENOTCONN        },
00927     { SOCESHUTDOWN,             ESHUTDOWN       },
00928     { SOCETOOMANYREFS,          ETOOMANYREFS    },
00929     { SOCELOOP,                 ELOOP           },
00930     { SOCEHOSTDOWN,             EHOSTDOWN       },
00931     { SOCENOTEMPTY,             ENOTEMPTY       },
00932     { SOCEPIPE,                 EPIPE           }
00933 */
00934 
00935 #elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */
00936 
00937 #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
00938 #define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
00939 
00940 #define apr_get_os_error()   (APR_FROM_OS_ERROR(GetLastError()))
00941 #define apr_set_os_error(e)  (SetLastError(APR_TO_OS_ERROR(e)))
00942 
00943 /* A special case, only socket calls require this:
00944  */
00945 #define apr_get_netos_error()   (APR_FROM_OS_ERROR(WSAGetLastError()))
00946 #define apr_set_netos_error(e)   (WSASetLastError(APR_TO_OS_ERROR(e)))
00947 
00948 /* APR CANONICAL ERROR TESTS */
00949 #define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES \
00950                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
00951                 || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
00952                 || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
00953                 || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
00954                 || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
00955                 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
00956                 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
00957                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
00958                 || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
00959                 || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
00960 #define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST \
00961                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
00962                 || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
00963 #define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG \
00964                 || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
00965                 || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
00966 #define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
00967                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
00968                 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
00969                 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
00970                 || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
00971 #define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR \
00972                 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
00973                 || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
00974                 || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
00975                 || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
00976                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE)
00977 #define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
00978                 || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
00979 #define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM \
00980                 || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
00981                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
00982                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
00983                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
00984                 || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
00985 #define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE \
00986                 || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
00987 #define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
00988 #define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF \
00989                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
00990                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
00991 #define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL \
00992                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
00993                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
00994                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
00995                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
00996                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
00997                 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
00998 #define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE \
00999                 || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
01000                 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
01001 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
01002                 || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
01003                 || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
01004                 || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
01005                 || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
01006                 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
01007                 || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
01008 #define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
01009                 || (s) == APR_OS_START_SYSERR + WSAEINTR)
01010 #define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
01011                 || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
01012 #define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
01013                 || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
01014 #define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
01015                 || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
01016 #define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
01017                 || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
01018 #define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
01019                 || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
01020                 || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
01021 // XXX deprecated
01022 #define APR_STATUS_IS_ETIMEDOUT(s)         ((s) == APR_ETIMEDOUT \
01023                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
01024                 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
01025 #undef APR_STATUS_IS_TIMEUP
01026 #define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
01027                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
01028                 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
01029 #define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
01030                 || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
01031 #define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
01032                 || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
01033 #define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE \
01034                 || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
01035                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
01036                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
01037                 || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
01038                 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
01039                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
01040                 || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
01041 #define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE \
01042                 || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
01043 #define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV \
01044                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
01045 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
01046                 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
01047 
01048 #elif defined(NETWARE) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
01049 
01050 #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
01051 #define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
01052 
01053 #define apr_get_os_error()    (errno)
01054 #define apr_set_os_error(e)   (errno = (e))
01055 
01056 /* A special case, only socket calls require this: */
01057 #define apr_get_netos_error()   (APR_FROM_OS_ERROR(WSAGetLastError()))
01058 #define apr_set_netos_error(e)  (WSASetLastError(APR_TO_OS_ERROR(e)))
01059 
01060 /* APR CANONICAL ERROR TESTS */
01061 #define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES)
01062 #define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST)
01063 #define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG)
01064 #define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT)
01065 #define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
01066 #define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC)
01067 #define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
01068 #define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE)
01069 #define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
01070 #define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF)
01071 #define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL)
01072 #define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE)
01073 
01074 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
01075                 || (s) ==                       EWOULDBLOCK \
01076                 || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
01077 #define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
01078                 || (s) == APR_OS_START_SYSERR + WSAEINTR)
01079 #define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
01080                 || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
01081 #define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
01082                 || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
01083 #define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
01084                 || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
01085 #define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
01086                 || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
01087 #define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
01088                 || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
01089 // XXX deprecated
01090 #define APR_STATUS_IS_ETIMEDOUT(s)       ((s) == APR_ETIMEDOUT \
01091                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
01092                 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
01093 #undef APR_STATUS_IS_TIMEUP
01094 #define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
01095                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
01096                 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
01097 #define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
01098                 || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
01099 #define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
01100                 || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
01101 #define APR_STATUS_IS_ENETDOWN(s)       ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
01102 #define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE)
01103 #define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE)
01104 #define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV)
01105 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY)
01106 
01107 #else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
01108 
01109 /*
01110  *  os error codes are clib error codes
01111  */
01112 #define APR_FROM_OS_ERROR(e)  (e)
01113 #define APR_TO_OS_ERROR(e)    (e)
01114 
01115 #define apr_get_os_error()    (errno)
01116 #define apr_set_os_error(e)   (errno = (e))
01117 
01118 /* A special case, only socket calls require this:
01119  */
01120 #define apr_get_netos_error() (errno)
01121 #define apr_set_netos_error(e) (errno = (e))
01122 
01123 /** 
01124  * @addtogroup APR_STATUS_IS
01125  * @{
01126  */
01127 
01128 /** permission denied */
01129 #define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES)
01130 /** file exists */
01131 #define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST)
01132 /** path name is too long */
01133 #define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG)
01134 /** no such file or directory */
01135 #define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT)
01136 /** not a directory */
01137 #define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
01138 /** no space left on device */
01139 #ifdef EDQUOT
01140 #define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
01141                                       || (s) == EDQUOT)
01142 #else
01143 #define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC)
01144 #endif
01145 /** not enough memory */
01146 #define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
01147 /** too many open files */
01148 #define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE)
01149 /** file table overflow */
01150 #define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
01151 /** bad file # */
01152 #define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF)
01153 /** invalid argument */
01154 #define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL)
01155 /** illegal seek */
01156 #define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE)
01157 
01158 /** operation would block */
01159 #if !defined(EWOULDBLOCK) || !defined(EAGAIN)
01160 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN)
01161 #elif (EWOULDBLOCK == EAGAIN)
01162 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN)
01163 #else
01164 #define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
01165                                       || (s) == EWOULDBLOCK)
01166 #endif
01167 
01168 /** interrupted system call */
01169 #define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR)
01170 /** socket operation on a non-socket */
01171 #define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK)
01172 /** Connection Refused */
01173 #define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED)
01174 /** operation now in progress */
01175 #define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS)
01176 
01177 /** 
01178  * Software caused connection abort 
01179  * @remark
01180  * EPROTO on certain older kernels really means ECONNABORTED, so we need to 
01181  * ignore it for them.  See discussion in new-httpd archives nh.9701 & nh.9603
01182  *
01183  * There is potentially a bug in Solaris 2.x x<6, and other boxes that 
01184  * implement tcp sockets in userland (i.e. on top of STREAMS).  On these
01185  * systems, EPROTO can actually result in a fatal loop.  See PR#981 for 
01186  * example.  It's hard to handle both uses of EPROTO.
01187  */
01188 #ifdef EPROTO
01189 #define APR_STATUS_IS_ECONNABORTED(s)    ((s) == APR_ECONNABORTED \
01190                                        || (s) == EPROTO)
01191 #else
01192 #define APR_STATUS_IS_ECONNABORTED(s)    ((s) == APR_ECONNABORTED)
01193 #endif
01194 
01195 /** Connection Reset by peer */
01196 #define APR_STATUS_IS_ECONNRESET(s)      ((s) == APR_ECONNRESET)
01197 /** Operation timed out
01198  *  @deprecated */
01199 #define APR_STATUS_IS_ETIMEDOUT(s)      ((s) == APR_ETIMEDOUT)
01200 /** no route to host */
01201 #define APR_STATUS_IS_EHOSTUNREACH(s)    ((s) == APR_EHOSTUNREACH)
01202 /** network is unreachable */
01203 #define APR_STATUS_IS_ENETUNREACH(s)     ((s) == APR_ENETUNREACH)
01204 /** inappropiate file type or format */
01205 #define APR_STATUS_IS_EFTYPE(s)          ((s) == APR_EFTYPE)
01206 /** broken pipe */
01207 #define APR_STATUS_IS_EPIPE(s)           ((s) == APR_EPIPE)
01208 /** cross device link */
01209 #define APR_STATUS_IS_EXDEV(s)           ((s) == APR_EXDEV)
01210 /** Directory Not Empty */
01211 #define APR_STATUS_IS_ENOTEMPTY(s)       ((s) == APR_ENOTEMPTY || \
01212                                           (s) == APR_EEXIST)
01213 /** @} */
01214 
01215 #endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
01216 
01217 /** @} */
01218 
01219 #ifdef __cplusplus
01220 }
01221 #endif
01222 
01223 #endif  /* ! APR_ERRNO_H */

Generated on Tue May 10 04:19:07 2005 for Apache Portable Runtime by  doxygen 1.3.9.1