1{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as 2 * applicable. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 } 16 17{ 18 * @file apr_errno.h 19 * @brief APR Error Codes 20 } 21 22{#include "apr.h" 23 24#if APR_HAVE_ERRNO_H 25#include <errno.h> 26#endif} 27 28{ 29 * @defgroup apr_errno Error Codes 30 * @ingroup APR 31 } 32 33{ 34 * Type for specifying an error or status code. 35 } 36type 37 apr_status_t = Integer; 38 Papr_status_t = ^apr_status_t; 39 40{ 41 * Return a human readable string describing the specified error. 42 * @param statcode The error code the get a string for. 43 * @param buf A buffer to hold the error string. 44 * @param bufsize Size of the buffer to hold the string. 45 } 46function apr_strerror(statcode: apr_status_t; buf: PChar; bufsize: apr_size_t): PChar; 47 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 48 external LibAPR name LibNamePrefix + 'apr_strerror' + LibSuff12; 49 50{$ifdef DOXYGEN)} 51{ 52 * @def APR_FROM_OS_ERROR(os_err_type syserr) 53 * Fold a platform specific error into an apr_status_t code. 54 * @return apr_status_t 55 * @param e The platform os error code. 56 * @warning macro implementation; the syserr argument may be evaluated 57 * multiple times. 58 } 59#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) 60 61{ 62 * @def APR_TO_OS_ERROR(apr_status_t statcode) 63 * @return os_err_type 64 * Fold an apr_status_t code back to the native platform defined error. 65 * @param e The apr_status_t folded platform os error code. 66 * @warning macro implementation; the statcode argument may be evaluated 67 * multiple times. If the statcode was not created by apr_get_os_error 68 * or APR_FROM_OS_ERROR, the results are undefined. 69 } 70#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) 71 72{ @def apr_get_os_error() 73 * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms 74 * @remark This retrieves errno, or calls a GetLastError() style function, and 75 * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no 76 * such mechanism, so this call may be unsupported. Do NOT use this 77 * call for socket errors from socket, send, recv etc! 78 } 79 80{ @def apr_set_os_error(e) 81 * Reset the last platform error, unfolded from an apr_status_t, on some platforms 82 * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR() 83 * @warning This is a macro implementation; the statcode argument may be evaluated 84 * multiple times. If the statcode was not created by apr_get_os_error 85 * or APR_FROM_OS_ERROR, the results are undefined. This macro sets 86 * errno, or calls a SetLastError() style function, unfolding statcode 87 * with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such 88 * mechanism, so this call may be unsupported. 89 } 90 91{ @def apr_get_netos_error() 92 * Return the last socket error, folded into apr_status_t, on all platforms 93 * @remark This retrieves errno or calls a GetLastSocketError() style function, 94 * and folds it with APR_FROM_OS_ERROR. 95 } 96 97{ @def apr_set_netos_error(e) 98 * Reset the last socket error, unfolded from an apr_status_t 99 * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR() 100 * @warning This is a macro implementation; the statcode argument may be evaluated 101 * multiple times. If the statcode was not created by apr_get_os_error 102 * or APR_FROM_OS_ERROR, the results are undefined. This macro sets 103 * errno, or calls a WSASetLastError() style function, unfolding 104 * socketcode with APR_TO_OS_ERROR. 105 } 106 107{$endif} { defined(DOXYGEN) } 108 109const 110{ 111 * APR_OS_START_ERROR is where the APR specific error values start. 112 } 113 APR_OS_START_ERROR = 20000; 114{ 115 * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit 116 * into one of the error/status ranges below -- except for 117 * APR_OS_START_USERERR, which see. 118 } 119 APR_OS_ERRSPACE_SIZE = 50000; 120{ 121 * APR_OS_START_STATUS is where the APR specific status codes start. 122 } 123 APR_OS_START_STATUS = (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE); 124{ 125 * APR_OS_START_USERERR are reserved for applications that use APR that 126 * layer their own error codes along with APR's. Note that the 127 * error immediately following this one is set ten times farther 128 * away than usual, so that users of apr have a lot of room in 129 * which to declare custom error codes. 130 } 131 APR_OS_START_USERERR = (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE); 132{ 133 * APR_OS_START_USEERR is obsolete, defined for compatibility only. 134 * Use APR_OS_START_USERERR instead. 135 } 136 APR_OS_START_USEERR = APR_OS_START_USERERR; 137{ 138 * APR_OS_START_CANONERR is where APR versions of errno values are defined 139 * on systems which don't have the corresponding errno. 140 } 141 APR_OS_START_CANONERR = (APR_OS_START_USERERR + (APR_OS_ERRSPACE_SIZE * 10)); 142{ 143 * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into 144 * apr_status_t values. 145 } 146 APR_OS_START_EAIERR = (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE); 147{ 148 * APR_OS_START_SYSERR folds platform-specific system error values into 149 * apr_status_t values. 150 } 151 APR_OS_START_SYSERR = (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE); 152 153{ no error. @see APR_STATUS_IS_SUCCESS } 154 APR_SUCCESS = 0; 155 156{ 157 * @defgroup APR_Error APR Error Values 158 * <PRE> 159 * <b>APR ERROR VALUES</b> 160 * APR_ENOSTAT APR was unable to perform a stat on the file 161 * APR_ENOPOOL APR was not provided a pool with which to allocate memory 162 * APR_EBADDATE APR was given an invalid date 163 * APR_EINVALSOCK APR was given an invalid socket 164 * APR_ENOPROC APR was not given a process structure 165 * APR_ENOTIME APR was not given a time structure 166 * APR_ENODIR APR was not given a directory structure 167 * APR_ENOLOCK APR was not given a lock structure 168 * APR_ENOPOLL APR was not given a poll structure 169 * APR_ENOSOCKET APR was not given a socket 170 * APR_ENOTHREAD APR was not given a thread structure 171 * APR_ENOTHDKEY APR was not given a thread key structure 172 * APR_ENOSHMAVAIL There is no more shared memory available 173 * APR_EDSOOPEN APR was unable to open the dso object. For more 174 * information call apr_dso_error(). 175 * APR_EGENERAL General failure (specific information not available) 176 * APR_EBADIP The specified IP address is invalid 177 * APR_EBADMASK The specified netmask is invalid 178 * APR_ESYMNOTFOUND Could not find the requested symbol 179 * </PRE> 180 * 181 * <PRE> 182 * <b>APR STATUS VALUES</b> 183 * APR_INCHILD Program is currently executing in the child 184 * APR_INPARENT Program is currently executing in the parent 185 * APR_DETACH The thread is detached 186 * APR_NOTDETACH The thread is not detached 187 * APR_CHILD_DONE The child has finished executing 188 * APR_CHILD_NOTDONE The child has not finished executing 189 * APR_TIMEUP The operation did not finish before the timeout 190 * APR_INCOMPLETE The operation was incomplete although some processing 191 * was performed and the results are partially valid 192 * APR_BADCH Getopt found an option not in the option string 193 * APR_BADARG Getopt found an option that is missing an argument 194 * and an argument was specified in the option string 195 * APR_EOF APR has encountered the end of the file 196 * APR_NOTFOUND APR was unable to find the socket in the poll structure 197 * APR_ANONYMOUS APR is using anonymous shared memory 198 * APR_FILEBASED APR is using a file name as the key to the shared memory 199 * APR_KEYBASED APR is using a shared key as the key to the shared memory 200 * APR_EINIT Ininitalizer value. If no option has been found, but 201 * the status variable requires a value, this should be used 202 * APR_ENOTIMPL The APR function has not been implemented on this 203 * platform, either because nobody has gotten to it yet, 204 * or the function is impossible on this platform. 205 * APR_EMISMATCH Two passwords do not match. 206 * APR_EABSOLUTE The given path was absolute. 207 * APR_ERELATIVE The given path was relative. 208 * APR_EINCOMPLETE The given path was neither relative nor absolute. 209 * APR_EABOVEROOT The given path was above the root path. 210 * APR_EBUSY The given lock was busy. 211 * APR_EPROC_UNKNOWN The given process wasn't recognized by APR 212 * </PRE> 213 } 214{ @see APR_STATUS_IS_ENOSTAT } 215 APR_ENOSTAT = (APR_OS_START_ERROR + 1); 216{ @see APR_STATUS_IS_ENOPOOL } 217 APR_ENOPOOL = (APR_OS_START_ERROR + 2); 218{ empty slot: +3 } 219{ @see APR_STATUS_IS_EBADDATE } 220 APR_EBADDATE = (APR_OS_START_ERROR + 4); 221{ @see APR_STATUS_IS_EINVALSOCK } 222 APR_EINVALSOCK = (APR_OS_START_ERROR + 5); 223{ @see APR_STATUS_IS_ENOPROC } 224 APR_ENOPROC = (APR_OS_START_ERROR + 6); 225{ @see APR_STATUS_IS_ENOTIME } 226 APR_ENOTIME = (APR_OS_START_ERROR + 7); 227{ @see APR_STATUS_IS_ENODIR } 228 APR_ENODIR = (APR_OS_START_ERROR + 8); 229{ @see APR_STATUS_IS_ENOLOCK } 230 APR_ENOLOCK = (APR_OS_START_ERROR + 9); 231{ @see APR_STATUS_IS_ENOPOLL } 232 APR_ENOPOLL = (APR_OS_START_ERROR + 10); 233{ @see APR_STATUS_IS_ENOSOCKET } 234 APR_ENOSOCKET = (APR_OS_START_ERROR + 11); 235{ @see APR_STATUS_IS_ENOTHREAD } 236 APR_ENOTHREAD = (APR_OS_START_ERROR + 12); 237{ @see APR_STATUS_IS_ENOTHDKEY } 238 APR_ENOTHDKEY = (APR_OS_START_ERROR + 13); 239{ @see APR_STATUS_IS_EGENERAL } 240 APR_EGENERAL = (APR_OS_START_ERROR + 14); 241{ @see APR_STATUS_IS_ENOSHMAVAIL } 242 APR_ENOSHMAVAIL = (APR_OS_START_ERROR + 15); 243{ @see APR_STATUS_IS_EBADIP } 244 APR_EBADIP = (APR_OS_START_ERROR + 16); 245{ @see APR_STATUS_IS_EBADMASK } 246 APR_EBADMASK = (APR_OS_START_ERROR + 17); 247{ empty slot: +18 } 248{ @see APR_STATUS_IS_EDSOPEN } 249 APR_EDSOOPEN = (APR_OS_START_ERROR + 19); 250{ @see APR_STATUS_IS_EABSOLUTE } 251 APR_EABSOLUTE = (APR_OS_START_ERROR + 20); 252{ @see APR_STATUS_IS_ERELATIVE } 253 APR_ERELATIVE = (APR_OS_START_ERROR + 21); 254{ @see APR_STATUS_IS_EINCOMPLETE } 255 APR_EINCOMPLETE = (APR_OS_START_ERROR + 22); 256{ @see APR_STATUS_IS_EABOVEROOT } 257 APR_EABOVEROOT = (APR_OS_START_ERROR + 23); 258{ @see APR_STATUS_IS_EBADPATH } 259 APR_EBADPATH = (APR_OS_START_ERROR + 24); 260{ @see APR_STATUS_IS_EPATHWILD } 261 APR_EPATHWILD = (APR_OS_START_ERROR + 25); 262{ @see APR_STATUS_IS_ESYMNOTFOUND } 263 APR_ESYMNOTFOUND = (APR_OS_START_ERROR + 26); 264{ @see APR_STATUS_IS_EPROC_UNKNOWN } 265 APR_EPROC_UNKNOWN = (APR_OS_START_ERROR + 27); 266{ @see APR_STATUS_IS_ENOTENOUGHENTROPY } 267 APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28); 268 269{ 270 * @defgroup APR_STATUS_IS Status Value Tests 271 * @warning For any particular error condition, more than one of these tests 272 * may match. This is because platform-specific error codes may not 273 * always match the semantics of the POSIX codes these tests (and the 274 * corresponding APR error codes) are named after. A notable example 275 * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on 276 * Win32 platforms. The programmer should always be aware of this and 277 * adjust the order of the tests accordingly. 278 } 279{ 280 * APR was unable to perform a stat on the file 281 * @warning always use this test, as platform-specific variances may meet this 282 * more than one error code 283 } 284//#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT) 285{ 286 * APR was not provided a pool with which to allocate memory 287 * @warning always use this test, as platform-specific variances may meet this 288 * more than one error code 289 } 290//#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL) 291{ APR was given an invalid date } 292//#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE) 293{ APR was given an invalid socket } 294//#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK) 295{ APR was not given a process structure } 296//#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC) 297{ APR was not given a time structure } 298//#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME) 299{ APR was not given a directory structure } 300//#define APR_STATUS_IS_ENODIR(s) ((s) == APR_ENODIR) 301{ APR was not given a lock structure } 302//#define APR_STATUS_IS_ENOLOCK(s) ((s) == APR_ENOLOCK) 303{ APR was not given a poll structure } 304//#define APR_STATUS_IS_ENOPOLL(s) ((s) == APR_ENOPOLL) 305{ APR was not given a socket } 306//#define APR_STATUS_IS_ENOSOCKET(s) ((s) == APR_ENOSOCKET) 307{ APR was not given a thread structure } 308//#define APR_STATUS_IS_ENOTHREAD(s) ((s) == APR_ENOTHREAD) 309{ APR was not given a thread key structure } 310//#define APR_STATUS_IS_ENOTHDKEY(s) ((s) == APR_ENOTHDKEY) 311{ Generic Error which can not be put into another spot } 312//#define APR_STATUS_IS_EGENERAL(s) ((s) == APR_EGENERAL) 313{ There is no more shared memory available } 314//#define APR_STATUS_IS_ENOSHMAVAIL(s) ((s) == APR_ENOSHMAVAIL) 315{ The specified IP address is invalid } 316//#define APR_STATUS_IS_EBADIP(s) ((s) == APR_EBADIP) 317{ The specified netmask is invalid } 318//#define APR_STATUS_IS_EBADMASK(s) ((s) == APR_EBADMASK) 319{ empty slot: +18 } 320{ 321 * APR was unable to open the dso object. 322 * For more information call apr_dso_error(). 323 } 324//#if defined(WIN32) 325//#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \ 326// || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND) 327//#else 328//#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN) 329//#endif 330{ The given path was absolute. } 331//#define APR_STATUS_IS_EABSOLUTE(s) ((s) == APR_EABSOLUTE) 332{ The given path was relative. } 333//#define APR_STATUS_IS_ERELATIVE(s) ((s) == APR_ERELATIVE) 334{ The given path was neither relative nor absolute. } 335//#define APR_STATUS_IS_EINCOMPLETE(s) ((s) == APR_EINCOMPLETE) 336{ The given path was above the root path. } 337//#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT) 338{ The given path was bad. } 339//#define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH) 340{ The given path contained wildcards. } 341//#define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD) 342{ Could not find the requested symbol. 343 * For more information call apr_dso_error(). 344 } 345//#if defined(WIN32) 346//#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \ 347// || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND) 348//#else 349//#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND) 350//#endif 351{ The given process was not recognized by APR. } 352//#define APR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == APR_EPROC_UNKNOWN) 353 354{ APR could not gather enough entropy to continue. } 355//#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY) 356 357{ 358 * @addtogroup APR_Error 359 } 360{ @see APR_STATUS_IS_INCHILD } 361 APR_INCHILD = (APR_OS_START_STATUS + 1); 362{ @see APR_STATUS_IS_INPARENT } 363 APR_INPARENT = (APR_OS_START_STATUS + 2); 364{ @see APR_STATUS_IS_DETACH } 365 APR_DETACH = (APR_OS_START_STATUS + 3); 366{ @see APR_STATUS_IS_NOTDETACH } 367 APR_NOTDETACH = (APR_OS_START_STATUS + 4); 368{ @see APR_STATUS_IS_CHILD_DONE } 369 APR_CHILD_DONE = (APR_OS_START_STATUS + 5); 370{ @see APR_STATUS_IS_CHILD_NOTDONE } 371 APR_CHILD_NOTDONE = (APR_OS_START_STATUS + 6); 372{ @see APR_STATUS_IS_TIMEUP } 373 APR_TIMEUP = (APR_OS_START_STATUS + 7); 374{ @see APR_STATUS_IS_INCOMPLETE } 375 APR_INCOMPLETE = (APR_OS_START_STATUS + 8); 376{ empty slot: +9 } 377{ empty slot: +10 } 378{ empty slot: +11 } 379{ @see APR_STATUS_IS_BADCH } 380 APR_BADCH = (APR_OS_START_STATUS + 12); 381{ @see APR_STATUS_IS_BADARG } 382 APR_BADARG = (APR_OS_START_STATUS + 13); 383{ @see APR_STATUS_IS_EOF } 384 APR_EOF = (APR_OS_START_STATUS + 14); 385{ @see APR_STATUS_IS_NOTFOUND } 386 APR_NOTFOUND = (APR_OS_START_STATUS + 15); 387{ empty slot: +16 } 388{ empty slot: +17 } 389{ empty slot: +18 } 390{ @see APR_STATUS_IS_ANONYMOUS } 391 APR_ANONYMOUS = (APR_OS_START_STATUS + 19); 392{ @see APR_STATUS_IS_FILEBASED } 393 APR_FILEBASED = (APR_OS_START_STATUS + 20); 394{ @see APR_STATUS_IS_KEYBASED } 395 APR_KEYBASED = (APR_OS_START_STATUS + 21); 396{ @see APR_STATUS_IS_EINIT } 397 APR_EINIT = (APR_OS_START_STATUS + 22); 398{ @see APR_STATUS_IS_ENOTIMPL } 399 APR_ENOTIMPL = (APR_OS_START_STATUS + 23); 400{ @see APR_STATUS_IS_EMISMATCH } 401 APR_EMISMATCH = (APR_OS_START_STATUS + 24); 402{ @see APR_STATUS_IS_EBUSY } 403 APR_EBUSY = (APR_OS_START_STATUS + 25); 404 405{ 406 * @addtogroup APR_STATUS_IS 407 } 408{ 409 * Program is currently executing in the child 410 * @warning 411 * always use this test, as platform-specific variances may meet this 412 * more than one error code } 413//#define APR_STATUS_IS_INCHILD(s) ((s) == APR_INCHILD) 414{ 415 * Program is currently executing in the parent 416 * @warning 417 * always use this test, as platform-specific variances may meet this 418 * more than one error code 419 } 420//#define APR_STATUS_IS_INPARENT(s) ((s) == APR_INPARENT) 421{ 422 * The thread is detached 423 * @warning 424 * always use this test, as platform-specific variances may meet this 425 * more than one error code 426 } 427//#define APR_STATUS_IS_DETACH(s) ((s) == APR_DETACH) 428{ 429 * The thread is not detached 430 * @warning 431 * always use this test, as platform-specific variances may meet this 432 * more than one error code 433 } 434//#define APR_STATUS_IS_NOTDETACH(s) ((s) == APR_NOTDETACH) 435{ 436 * The child has finished executing 437 * @warning 438 * always use this test, as platform-specific variances may meet this 439 * more than one error code 440 } 441//#define APR_STATUS_IS_CHILD_DONE(s) ((s) == APR_CHILD_DONE) 442{ 443 * The child has not finished executing 444 * @warning 445 * always use this test, as platform-specific variances may meet this 446 * more than one error code 447 } 448//#define APR_STATUS_IS_CHILD_NOTDONE(s) ((s) == APR_CHILD_NOTDONE) 449{ 450 * The operation did not finish before the timeout 451 * @warning 452 * always use this test, as platform-specific variances may meet this 453 * more than one error code 454 } 455//#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP) 456{ 457 * The operation was incomplete although some processing was performed 458 * and the results are partially valid. 459 * @warning 460 * always use this test, as platform-specific variances may meet this 461 * more than one error code 462 } 463//#define APR_STATUS_IS_INCOMPLETE(s) ((s) == APR_INCOMPLETE) 464{ empty slot: +9 } 465{ empty slot: +10 } 466{ empty slot: +11 } 467{ 468 * Getopt found an option not in the option string 469 * @warning 470 * always use this test, as platform-specific variances may meet this 471 * more than one error code 472 } 473//#define APR_STATUS_IS_BADCH(s) ((s) == APR_BADCH) 474{ 475 * Getopt found an option not in the option string and an argument was 476 * specified in the option string 477 * @warning 478 * always use this test, as platform-specific variances may meet this 479 * more than one error code 480 } 481//#define APR_STATUS_IS_BADARG(s) ((s) == APR_BADARG) 482{ 483 * APR has encountered the end of the file 484 * @warning 485 * always use this test, as platform-specific variances may meet this 486 * more than one error code 487 } 488//#define APR_STATUS_IS_EOF(s) ((s) == APR_EOF) 489{ 490 * APR was unable to find the socket in the poll structure 491 * @warning 492 * always use this test, as platform-specific variances may meet this 493 * more than one error code 494 } 495//#define APR_STATUS_IS_NOTFOUND(s) ((s) == APR_NOTFOUND) 496{ empty slot: +16 } 497{ empty slot: +17 } 498{ empty slot: +18 } 499{ 500 * APR is using anonymous shared memory 501 * @warning 502 * always use this test, as platform-specific variances may meet this 503 * more than one error code 504 } 505//#define APR_STATUS_IS_ANONYMOUS(s) ((s) == APR_ANONYMOUS) 506{ 507 * APR is using a file name as the key to the shared memory 508 * @warning 509 * always use this test, as platform-specific variances may meet this 510 * more than one error code 511 } 512//#define APR_STATUS_IS_FILEBASED(s) ((s) == APR_FILEBASED) 513{ 514 * APR is using a shared key as the key to the shared memory 515 * @warning 516 * always use this test, as platform-specific variances may meet this 517 * more than one error code 518 } 519//#define APR_STATUS_IS_KEYBASED(s) ((s) == APR_KEYBASED) 520{ 521 * Ininitalizer value. If no option has been found, but 522 * the status variable requires a value, this should be used 523 * @warning 524 * always use this test, as platform-specific variances may meet this 525 * more than one error code 526 } 527//#define APR_STATUS_IS_EINIT(s) ((s) == APR_EINIT) 528{ 529 * The APR function has not been implemented on this 530 * platform, either because nobody has gotten to it yet, 531 * or the function is impossible on this platform. 532 * @warning 533 * always use this test, as platform-specific variances may meet this 534 * more than one error code 535 } 536//#define APR_STATUS_IS_ENOTIMPL(s) ((s) == APR_ENOTIMPL) 537{ 538 * Two passwords do not match. 539 * @warning 540 * always use this test, as platform-specific variances may meet this 541 * more than one error code 542 } 543//#define APR_STATUS_IS_EMISMATCH(s) ((s) == APR_EMISMATCH) 544{ 545 * The given lock was busy 546 * @warning always use this test, as platform-specific variances may meet this 547 * more than one error code 548 } 549//#define APR_STATUS_IS_EBUSY(s) ((s) == APR_EBUSY) 550 551{ 552 * @addtogroup APR_Error APR Error Values 553 } 554{ APR CANONICAL ERROR VALUES } 555{ @see APR_STATUS_IS_EACCES } 556{#ifdef EACCES 557#define APR_EACCES EACCES 558#else 559#define APR_EACCES (APR_OS_START_CANONERR + 1) 560#endif 561} 562{ @see APR_STATUS_IS_EXIST } 563{#ifdef EEXIST 564#define APR_EEXIST EEXIST 565#else 566#define APR_EEXIST (APR_OS_START_CANONERR + 2) 567#endif 568} 569{ @see APR_STATUS_IS_ENAMETOOLONG } 570{#ifdef ENAMETOOLONG 571#define APR_ENAMETOOLONG ENAMETOOLONG 572#else 573#define APR_ENAMETOOLONG (APR_OS_START_CANONERR + 3) 574#endif 575} 576{ @see APR_STATUS_IS_ENOENT } 577{#ifdef ENOENT 578#define APR_ENOENT ENOENT 579#else 580#define APR_ENOENT (APR_OS_START_CANONERR + 4) 581#endif 582} 583{ @see APR_STATUS_IS_ENOTDIR } 584{#ifdef ENOTDIR 585#define APR_ENOTDIR ENOTDIR 586#else 587#define APR_ENOTDIR (APR_OS_START_CANONERR + 5) 588#endif 589} 590{ @see APR_STATUS_IS_ENOSPC } 591{#ifdef ENOSPC 592#define APR_ENOSPC ENOSPC 593#else 594#define APR_ENOSPC (APR_OS_START_CANONERR + 6) 595#endif 596} 597{ @see APR_STATUS_IS_ENOMEM } 598{#ifdef ENOMEM 599#define APR_ENOMEM ENOMEM 600#else 601#define APR_ENOMEM (APR_OS_START_CANONERR + 7) 602#endif 603} 604{ @see APR_STATUS_IS_EMFILE } 605{#ifdef EMFILE 606#define APR_EMFILE EMFILE 607#else 608#define APR_EMFILE (APR_OS_START_CANONERR + 8) 609#endif 610} 611{ @see APR_STATUS_IS_ENFILE } 612{#ifdef ENFILE 613#define APR_ENFILE ENFILE 614#else 615#define APR_ENFILE (APR_OS_START_CANONERR + 9) 616#endif 617} 618{ @see APR_STATUS_IS_EBADF } 619{#ifdef EBADF 620#define APR_EBADF EBADF 621#else 622#define APR_EBADF (APR_OS_START_CANONERR + 10) 623#endif 624} 625{ @see APR_STATUS_IS_EINVAL } 626{#ifdef EINVAL 627#define APR_EINVAL EINVAL 628#else 629#define APR_EINVAL (APR_OS_START_CANONERR + 11) 630#endif 631} 632{ @see APR_STATUS_IS_ESPIPE } 633{#ifdef ESPIPE 634#define APR_ESPIPE ESPIPE 635#else 636#define APR_ESPIPE (APR_OS_START_CANONERR + 12) 637#endif 638} 639{ 640 * @see APR_STATUS_IS_EAGAIN 641 * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value 642 } 643{#ifdef EAGAIN 644#define APR_EAGAIN EAGAIN 645#elif defined(EWOULDBLOCK) 646#define APR_EAGAIN EWOULDBLOCK 647#else 648#define APR_EAGAIN (APR_OS_START_CANONERR + 13) 649#endif 650} 651{ @see APR_STATUS_IS_EINTR } 652{#ifdef EINTR 653#define APR_EINTR EINTR 654#else 655#define APR_EINTR (APR_OS_START_CANONERR + 14) 656#endif 657} 658{ @see APR_STATUS_IS_ENOTSOCK } 659{#ifdef ENOTSOCK 660#define APR_ENOTSOCK ENOTSOCK 661#else 662#define APR_ENOTSOCK (APR_OS_START_CANONERR + 15) 663#endif 664} 665{ @see APR_STATUS_IS_ECONNREFUSED } 666{#ifdef ECONNREFUSED 667#define APR_ECONNREFUSED ECONNREFUSED 668#else 669#define APR_ECONNREFUSED (APR_OS_START_CANONERR + 16) 670#endif 671} 672{ @see APR_STATUS_IS_EINPROGRESS } 673{#ifdef EINPROGRESS 674#define APR_EINPROGRESS EINPROGRESS 675#else 676#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17) 677#endif 678} 679{ 680 * @see APR_STATUS_IS_ECONNABORTED 681 * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value 682 } 683 684{#ifdef ECONNABORTED 685#define APR_ECONNABORTED ECONNABORTED 686#else 687#define APR_ECONNABORTED (APR_OS_START_CANONERR + 18) 688#endif 689} 690{ @see APR_STATUS_IS_ECONNRESET } 691{#ifdef ECONNRESET 692#define APR_ECONNRESET ECONNRESET 693#else 694#define APR_ECONNRESET (APR_OS_START_CANONERR + 19) 695#endif 696} 697{* @see APR_STATUS_IS_ETIMEDOUT 698 * @deprecated} 699{#ifdef ETIMEDOUT 700#define APR_ETIMEDOUT ETIMEDOUT 701#else 702#define APR_ETIMEDOUT (APR_OS_START_CANONERR + 20) 703#endif 704} 705{ @see APR_STATUS_IS_EHOSTUNREACH } 706{#ifdef EHOSTUNREACH 707#define APR_EHOSTUNREACH EHOSTUNREACH 708#else 709#define APR_EHOSTUNREACH (APR_OS_START_CANONERR + 21) 710#endif 711} 712{ @see APR_STATUS_IS_ENETUNREACH } 713{#ifdef ENETUNREACH 714#define APR_ENETUNREACH ENETUNREACH 715#else 716#define APR_ENETUNREACH (APR_OS_START_CANONERR + 22) 717#endif 718} 719{ @see APR_STATUS_IS_EFTYPE } 720{#ifdef EFTYPE 721#define APR_EFTYPE EFTYPE 722#else 723#define APR_EFTYPE (APR_OS_START_CANONERR + 23) 724#endif 725} 726{ @see APR_STATUS_IS_EPIPE } 727{#ifdef EPIPE 728#define APR_EPIPE EPIPE 729#else 730#define APR_EPIPE (APR_OS_START_CANONERR + 24) 731#endif 732} 733{ @see APR_STATUS_IS_EXDEV } 734{#ifdef EXDEV 735#define APR_EXDEV EXDEV 736#else 737#define APR_EXDEV (APR_OS_START_CANONERR + 25) 738#endif 739} 740{ @see APR_STATUS_IS_ENOTEMPTY } 741{#ifdef ENOTEMPTY 742#define APR_ENOTEMPTY ENOTEMPTY 743#else 744#define APR_ENOTEMPTY (APR_OS_START_CANONERR + 26) 745#endif 746 747#if defined(OS2) && !defined(DOXYGEN) 748 749#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) 750#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) 751 752#define INCL_DOSERRORS 753#define INCL_DOS 754} 755{ Leave these undefined. 756 * OS2 doesn't rely on the errno concept. 757 * The API calls always return a result codes which 758 * should be filtered through APR_FROM_OS_ERROR(). 759 * 760 * #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) 761 * #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e))) 762 } 763 764{ A special case, only socket calls require this; 765 } 766{#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno)) 767#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e)) 768} 769{ And this needs to be greped away for good: 770 } 771{#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e)) 772 773} 774{ These can't sit in a private header, so in spite of the extra size, 775 * they need to be made available here. 776 } 777 SOCBASEERR = 10000; 778 SOCEPERM = (SOCBASEERR+1); { Not owner } 779 SOCESRCH = (SOCBASEERR+3); { No such process } 780 SOCEINTR = (SOCBASEERR+4); { Interrupted system call } 781 SOCENXIO = (SOCBASEERR+6); { No such device or address } 782 SOCEBADF = (SOCBASEERR+9); { Bad file number } 783 SOCEACCES = (SOCBASEERR+13); { Permission denied } 784 SOCEFAULT = (SOCBASEERR+14); { Bad address } 785 SOCEINVAL = (SOCBASEERR+22); { Invalid argument } 786 SOCEMFILE = (SOCBASEERR+24); { Too many open files } 787 SOCEPIPE = (SOCBASEERR+32); { Broken pipe } 788 SOCEOS2ERR = (SOCBASEERR+100); { OS/2 Error } 789 SOCEWOULDBLOCK = (SOCBASEERR+35); { Operation would block } 790 SOCEINPROGRESS = (SOCBASEERR+36); { Operation now in progress } 791 SOCEALREADY = (SOCBASEERR+37); { Operation already in progress } 792 SOCENOTSOCK = (SOCBASEERR+38); { Socket operation on non-socket } 793 SOCEDESTADDRREQ = (SOCBASEERR+39); { Destination address required } 794 SOCEMSGSIZE = (SOCBASEERR+40); { Message too long } 795 SOCEPROTOTYPE = (SOCBASEERR+41); { Protocol wrong type for socket } 796 SOCENOPROTOOPT = (SOCBASEERR+42); { Protocol not available } 797 SOCEPROTONOSUPPORT = (SOCBASEERR+43); { Protocol not supported } 798 SOCESOCKTNOSUPPORT = (SOCBASEERR+44); { Socket type not supported } 799 SOCEOPNOTSUPP = (SOCBASEERR+45); { Operation not supported on socket } 800 SOCEPFNOSUPPORT = (SOCBASEERR+46); { Protocol family not supported } 801 SOCEAFNOSUPPORT = (SOCBASEERR+47); { Address family not supported by protocol family } 802 SOCEADDRINUSE = (SOCBASEERR+48); { Address already in use } 803 SOCEADDRNOTAVAIL = (SOCBASEERR+49); { Can't assign requested address } 804 SOCENETDOWN = (SOCBASEERR+50); { Network is down } 805 SOCENETUNREACH = (SOCBASEERR+51); { Network is unreachable } 806 SOCENETRESET = (SOCBASEERR+52); { Network dropped connection on reset } 807 SOCECONNABORTED = (SOCBASEERR+53); { Software caused connection abort } 808 SOCECONNRESET = (SOCBASEERR+54); { Connection reset by peer } 809 SOCENOBUFS = (SOCBASEERR+55); { No buffer space available } 810 SOCEISCONN = (SOCBASEERR+56); { Socket is already connected } 811 SOCENOTCONN = (SOCBASEERR+57); { Socket is not connected } 812 SOCESHUTDOWN = (SOCBASEERR+58); { Can't send after socket shutdown } 813 SOCETOOMANYREFS = (SOCBASEERR+59); { Too many references: can't splice } 814 SOCETIMEDOUT = (SOCBASEERR+60); { Connection timed out } 815 SOCECONNREFUSED = (SOCBASEERR+61); { Connection refused } 816 SOCELOOP = (SOCBASEERR+62); { Too many levels of symbolic links } 817 SOCENAMETOOLONG = (SOCBASEERR+63); { File name too long } 818 SOCEHOSTDOWN = (SOCBASEERR+64); { Host is down } 819 SOCEHOSTUNREACH = (SOCBASEERR+65); { No route to host } 820 SOCENOTEMPTY = (SOCBASEERR+66); { Directory not empty } 821 822{ APR CANONICAL ERROR TESTS } 823{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \ 824 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \ 825 || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION) 826#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \ 827 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \ 828 || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \ 829 || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \ 830 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED) 831#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \ 832 || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \ 833 || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG) 834#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \ 835 || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \ 836 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ 837 || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \ 838 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED) 839#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR) 840#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \ 841 || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL) 842#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM) 843#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \ 844 || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES) 845#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE) 846#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \ 847 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE) 848#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \ 849 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \ 850 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION) 851#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \ 852 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK) 853#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \ 854 || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \ 855 || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \ 856 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION) 857#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \ 858 || (s) == APR_OS_START_SYSERR + SOCEINTR) 859#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \ 860 || (s) == APR_OS_START_SYSERR + SOCENOTSOCK) 861#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \ 862 || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED) 863#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \ 864 || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS) 865#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \ 866 || (s) == APR_OS_START_SYSERR + SOCECONNABORTED) 867#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \ 868 || (s) == APR_OS_START_SYSERR + SOCECONNRESET) 869/* XXX deprecated */ 870#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \ 871 || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT) 872#undef APR_STATUS_IS_TIMEUP 873#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \ 874 || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT) 875#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \ 876 || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH) 877#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \ 878 || (s) == APR_OS_START_SYSERR + SOCENETUNREACH) 879#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE) 880#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \ 881 || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \ 882 || (s) == APR_OS_START_SYSERR + SOCEPIPE) 883#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \ 884 || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE) 885#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \ 886 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \ 887 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED) 888} 889{ 890 Sorry, too tired to wrap this up for OS2... feel free to 891 fit the following into their best matches. 892 893 ( ERROR_NO_SIGNAL_SENT, ESRCH ), 894 ( SOCEALREADY, EALREADY ), 895 ( SOCEDESTADDRREQ, EDESTADDRREQ ), 896 ( SOCEMSGSIZE, EMSGSIZE ), 897 ( SOCEPROTOTYPE, EPROTOTYPE ), 898 ( SOCENOPROTOOPT, ENOPROTOOPT ), 899 ( SOCEPROTONOSUPPORT, EPROTONOSUPPORT ), 900 ( SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT ), 901 ( SOCEOPNOTSUPP, EOPNOTSUPP ), 902 ( SOCEPFNOSUPPORT, EPFNOSUPPORT ), 903 ( SOCEAFNOSUPPORT, EAFNOSUPPORT ), 904 ( SOCEADDRINUSE, EADDRINUSE ), 905 ( SOCEADDRNOTAVAIL, EADDRNOTAVAIL ), 906 ( SOCENETDOWN, ENETDOWN ), 907 ( SOCENETRESET, ENETRESET ), 908 ( SOCENOBUFS, ENOBUFS ), 909 ( SOCEISCONN, EISCONN ), 910 ( SOCENOTCONN, ENOTCONN ), 911 ( SOCESHUTDOWN, ESHUTDOWN ), 912 ( SOCETOOMANYREFS, ETOOMANYREFS ), 913 ( SOCELOOP, ELOOP ), 914 ( SOCEHOSTDOWN, EHOSTDOWN ), 915 ( SOCENOTEMPTY, ENOTEMPTY ), 916 ( SOCEPIPE, EPIPE ) 917} 918 919//#elif defined(WIN32) && !defined(DOXYGEN) { !defined(OS2) } 920 921{#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) 922#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) 923 924#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) 925#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))} 926 927{ A special case, only socket calls require this: 928 } 929{#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) 930#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) 931 932} 933{ APR CANONICAL ERROR TESTS } 934{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \ 935 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \ 936 || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \ 937 || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \ 938 || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \ 939 || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \ 940 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \ 941 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \ 942 || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \ 943 || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \ 944 || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION) 945#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \ 946 || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \ 947 || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS) 948#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \ 949 || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \ 950 || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG) 951#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \ 952 || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \ 953 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ 954 || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \ 955 || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES) 956#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR \ 957 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ 958 || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \ 959 || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \ 960 || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \ 961 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE) 962#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \ 963 || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL) 964#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM \ 965 || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \ 966 || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \ 967 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \ 968 || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \ 969 || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY) 970#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \ 971 || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES) 972#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE) 973#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \ 974 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \ 975 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE) 976#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \ 977 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \ 978 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \ 979 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \ 980 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \ 981 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \ 982 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK) 983#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \ 984 || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \ 985 || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK) 986#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \ 987 || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \ 988 || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \ 989 || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \ 990 || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \ 991 || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \ 992 || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK) 993#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \ 994 || (s) == APR_OS_START_SYSERR + WSAEINTR) 995#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \ 996 || (s) == APR_OS_START_SYSERR + WSAENOTSOCK) 997#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \ 998 || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED) 999#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \ 1000 || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS) 1001#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \ 1002 || (s) == APR_OS_START_SYSERR + WSAECONNABORTED) 1003#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \ 1004 || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \ 1005 || (s) == APR_OS_START_SYSERR + WSAECONNRESET) 1006/* XXX deprecated */ 1007#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \ 1008 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \ 1009 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT) 1010#undef APR_STATUS_IS_TIMEUP 1011#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \ 1012 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \ 1013 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT) 1014#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \ 1015 || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH) 1016#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \ 1017 || (s) == APR_OS_START_SYSERR + WSAENETUNREACH) 1018#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE \ 1019 || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \ 1020 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \ 1021 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \ 1022 || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \ 1023 || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \ 1024 || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \ 1025 || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT) 1026#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \ 1027 || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE) 1028#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \ 1029 || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE) 1030#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \ 1031 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY) 1032} 1033//#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) { !defined(OS2) && !defined(WIN32) } 1034{ 1035#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) 1036#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) 1037 1038#define apr_get_os_error() (errno) 1039#define apr_set_os_error(e) (errno = (e)) 1040} 1041{ A special case, only socket calls require this: } 1042{#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) 1043#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) 1044 1045} 1046{ APR CANONICAL ERROR TESTS } 1047{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES) 1048#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST) 1049#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG) 1050#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT) 1051#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR) 1052#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC) 1053#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM) 1054#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE) 1055#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE) 1056#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF) 1057#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL) 1058#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE) 1059 1060#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \ 1061 || (s) == EWOULDBLOCK \ 1062 || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK) 1063#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \ 1064 || (s) == APR_OS_START_SYSERR + WSAEINTR) 1065#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \ 1066 || (s) == APR_OS_START_SYSERR + WSAENOTSOCK) 1067#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \ 1068 || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED) 1069#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \ 1070 || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS) 1071#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \ 1072 || (s) == APR_OS_START_SYSERR + WSAECONNABORTED) 1073#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \ 1074 || (s) == APR_OS_START_SYSERR + WSAECONNRESET) 1075/* XXX deprecated */ 1076#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \ 1077 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \ 1078 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT) 1079#undef APR_STATUS_IS_TIMEUP 1080#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \ 1081 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \ 1082 || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT) 1083#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \ 1084 || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH) 1085#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \ 1086 || (s) == APR_OS_START_SYSERR + WSAENETUNREACH) 1087#define APR_STATUS_IS_ENETDOWN(s) ((s) == APR_OS_START_SYSERR + WSAENETDOWN) 1088#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE) 1089#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE) 1090#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV) 1091#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY) 1092} 1093//#else { !defined(NETWARE) && !defined(OS2) && !defined(WIN32) } 1094 1095{ 1096 * os error codes are clib error codes 1097 } 1098{#define APR_FROM_OS_ERROR(e) (e) 1099#define APR_TO_OS_ERROR(e) (e) 1100 1101#define apr_get_os_error() (errno) 1102#define apr_set_os_error(e) (errno = (e)) 1103} 1104{ A special case, only socket calls require this: 1105 } 1106//#define apr_get_netos_error() (errno) 1107//#define apr_set_netos_error(e) (errno = (e)) 1108 1109{ 1110 * @addtogroup APR_STATUS_IS 1111 } 1112 1113{ permission denied } 1114//#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES) 1115{ file exists } 1116//#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST) 1117{ path name is too long } 1118//#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG) 1119{ 1120 * no such file or directory 1121 * @remark 1122 * EMVSCATLG can be returned by the automounter on z/OS for 1123 * paths which do not exist. 1124 } 1125{#ifdef EMVSCATLG 1126#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \ 1127 || (s) == EMVSCATLG) 1128#else 1129#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT) 1130#endif} 1131{ not a directory } 1132//#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR) 1133{ no space left on device } 1134//#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC) 1135{ not enough memory } 1136//#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM) 1137{ too many open files } 1138//#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE) 1139{ file table overflow } 1140//#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE) 1141{ bad file # } 1142//#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF) 1143{ invalid argument } 1144//#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL) 1145{ illegal seek } 1146//#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE) 1147 1148{ operation would block } 1149{#if !defined(EWOULDBLOCK) || !defined(EAGAIN) 1150#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN) 1151#elif (EWOULDBLOCK == EAGAIN) 1152#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN) 1153#else 1154#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \ 1155 || (s) == EWOULDBLOCK) 1156#endif 1157} 1158{ interrupted system call } 1159//#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR) 1160{ socket operation on a non-socket } 1161//#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK) 1162{ Connection Refused } 1163//#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED) 1164{ operation now in progress } 1165//#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS) 1166 1167{ 1168 * Software caused connection abort 1169 * @remark 1170 * EPROTO on certain older kernels really means ECONNABORTED, so we need to 1171 * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603 1172 * 1173 * There is potentially a bug in Solaris 2.x x<6, and other boxes that 1174 * implement tcp sockets in userland (i.e. on top of STREAMS). On these 1175 * systems, EPROTO can actually result in a fatal loop. See PR#981 for 1176 * example. It's hard to handle both uses of EPROTO. 1177 } 1178{#ifdef EPROTO 1179#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \ 1180 || (s) == EPROTO) 1181#else 1182#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED) 1183#endif 1184} 1185{ Connection Reset by peer } 1186//#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET) 1187{* Operation timed out 1188 * @deprecated} 1189//#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT) 1190{ no route to host } 1191//#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH) 1192{ network is unreachable } 1193//#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH) 1194{ inappropiate file type or format } 1195//#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE) 1196{ broken pipe } 1197//#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE) 1198{ cross device link } 1199//#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV) 1200{ Directory Not Empty } 1201//#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY || \ 1202// (s) == APR_EEXIST) 1203 1204//#endif { !defined(NETWARE) && !defined(OS2) && !defined(WIN32) } 1205 1206