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