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

Generated on Sun Nov 20 18:49:38 2005 for Apache Portable Runtime by doxygen 1.3.8