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