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_UTIL_ERRSPACE_SIZE is the size of the space that is reserved for
126
* use within apr-util. This space is reserved above that used by APR
128
* @note This number MUST be smaller than APR_OS_ERRSPACE_SIZE by a
129
* large enough amount that APR has sufficient room for it's
132
#define APR_UTIL_ERRSPACE_SIZE 20000
134
* APR_OS_START_STATUS is where the APR specific status codes start.
136
#define APR_OS_START_STATUS (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
138
* APR_UTIL_START_STATUS is where APR-Util starts defining it's
141
#define APR_UTIL_START_STATUS (APR_OS_START_STATUS + \
142
(APR_OS_ERRSPACE_SIZE - APR_UTIL_ERRSPACE_SIZE))
144
* APR_OS_START_USERERR are reserved for applications that use APR that
145
* layer their own error codes along with APR's. Note that the
146
* error immediately following this one is set ten times farther
147
* away than usual, so that users of apr have a lot of room in
148
* which to declare custom error codes.
150
* In general applications should try and create unique error codes. To try
151
* and assist in finding suitable ranges of numbers to use, the following
152
* ranges are known to be used by the listed applications. If your
153
* application defines error codes please advise the range of numbers it
154
* uses to dev@apr.apache.org for inclusion in this list.
156
* Ranges shown are in relation to APR_OS_START_USERERR
158
* Subversion - Defined ranges, of less than 100, at intervals of 5000
159
* starting at an offset of 5000, e.g.
160
* +5000 to 5100, +10000 to 10100
162
#define APR_OS_START_USERERR (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
164
* APR_OS_START_USEERR is obsolete, defined for compatibility only.
165
* Use APR_OS_START_USERERR instead.
167
#define APR_OS_START_USEERR APR_OS_START_USERERR
169
* APR_OS_START_CANONERR is where APR versions of errno values are defined
170
* on systems which don't have the corresponding errno.
172
#define APR_OS_START_CANONERR (APR_OS_START_USERERR \
173
+ (APR_OS_ERRSPACE_SIZE * 10))
175
* APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
176
* apr_status_t values.
178
#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
180
* APR_OS_START_SYSERR folds platform-specific system error values into
181
* apr_status_t values.
183
#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
186
* @defgroup APR_ERROR_map APR Error Space
188
* The following attempts to show the relation of the various constants
189
* used for mapping APR Status codes.
193
* 20,000 APR_OS_START_ERROR
195
* + APR_OS_ERRSPACE_SIZE (50,000)
197
* 70,000 APR_OS_START_STATUS
199
* + APR_OS_ERRSPACE_SIZE - APR_UTIL_ERRSPACE_SIZE (30,000)
201
* 100,000 APR_UTIL_START_STATUS
203
* + APR_UTIL_ERRSPACE_SIZE (20,000)
205
* 120,000 APR_OS_START_USERERR
207
* + 10 x APR_OS_ERRSPACE_SIZE (50,000 * 10)
209
* 620,000 APR_OS_START_CANONERR
211
* + APR_OS_ERRSPACE_SIZE (50,000)
213
* 670,000 APR_OS_START_EAIERR
215
* + APR_OS_ERRSPACE_SIZE (50,000)
217
* 720,000 APR_OS_START_SYSERR
223
#define APR_SUCCESS 0
226
* @defgroup APR_Error APR Error Values
228
* <b>APR ERROR VALUES</b>
229
* APR_ENOSTAT APR was unable to perform a stat on the file
230
* APR_ENOPOOL APR was not provided a pool with which to allocate memory
231
* APR_EBADDATE APR was given an invalid date
232
* APR_EINVALSOCK APR was given an invalid socket
233
* APR_ENOPROC APR was not given a process structure
234
* APR_ENOTIME APR was not given a time structure
235
* APR_ENODIR APR was not given a directory structure
236
* APR_ENOLOCK APR was not given a lock structure
237
* APR_ENOPOLL APR was not given a poll structure
238
* APR_ENOSOCKET APR was not given a socket
239
* APR_ENOTHREAD APR was not given a thread structure
240
* APR_ENOTHDKEY APR was not given a thread key structure
241
* APR_ENOSHMAVAIL There is no more shared memory available
242
* APR_EDSOOPEN APR was unable to open the dso object. For more
243
* information call apr_dso_error().
244
* APR_EGENERAL General failure (specific information not available)
245
* APR_EBADIP The specified IP address is invalid
246
* APR_EBADMASK The specified netmask is invalid
247
* APR_ESYMNOTFOUND Could not find the requested symbol
248
* APR_ENOTENOUGHENTROPY Not enough entropy to continue
252
* <b>APR STATUS VALUES</b>
253
* APR_INCHILD Program is currently executing in the child
254
* APR_INPARENT Program is currently executing in the parent
255
* APR_DETACH The thread is detached
256
* APR_NOTDETACH The thread is not detached
257
* APR_CHILD_DONE The child has finished executing
258
* APR_CHILD_NOTDONE The child has not finished executing
259
* APR_TIMEUP The operation did not finish before the timeout
260
* APR_INCOMPLETE The operation was incomplete although some processing
261
* was performed and the results are partially valid
262
* APR_BADCH Getopt found an option not in the option string
263
* APR_BADARG Getopt found an option that is missing an argument
264
* and an argument was specified in the option string
265
* APR_EOF APR has encountered the end of the file
266
* APR_NOTFOUND APR was unable to find the socket in the poll structure
267
* APR_ANONYMOUS APR is using anonymous shared memory
268
* APR_FILEBASED APR is using a file name as the key to the shared memory
269
* APR_KEYBASED APR is using a shared key as the key to the shared memory
270
* APR_EINIT Ininitalizer value. If no option has been found, but
271
* the status variable requires a value, this should be used
272
* APR_ENOTIMPL The APR function has not been implemented on this
273
* platform, either because nobody has gotten to it yet,
274
* or the function is impossible on this platform.
275
* APR_EMISMATCH Two passwords do not match.
276
* APR_EABSOLUTE The given path was absolute.
277
* APR_ERELATIVE The given path was relative.
278
* APR_EINCOMPLETE The given path was neither relative nor absolute.
279
* APR_EABOVEROOT The given path was above the root path.
280
* APR_EBUSY The given lock was busy.
281
* APR_EPROC_UNKNOWN The given process wasn't recognized by APR
285
/** @see APR_STATUS_IS_ENOSTAT */
286
#define APR_ENOSTAT (APR_OS_START_ERROR + 1)
287
/** @see APR_STATUS_IS_ENOPOOL */
288
#define APR_ENOPOOL (APR_OS_START_ERROR + 2)
290
/** @see APR_STATUS_IS_EBADDATE */
291
#define APR_EBADDATE (APR_OS_START_ERROR + 4)
292
/** @see APR_STATUS_IS_EINVALSOCK */
293
#define APR_EINVALSOCK (APR_OS_START_ERROR + 5)
294
/** @see APR_STATUS_IS_ENOPROC */
295
#define APR_ENOPROC (APR_OS_START_ERROR + 6)
296
/** @see APR_STATUS_IS_ENOTIME */
297
#define APR_ENOTIME (APR_OS_START_ERROR + 7)
298
/** @see APR_STATUS_IS_ENODIR */
299
#define APR_ENODIR (APR_OS_START_ERROR + 8)
300
/** @see APR_STATUS_IS_ENOLOCK */
301
#define APR_ENOLOCK (APR_OS_START_ERROR + 9)
302
/** @see APR_STATUS_IS_ENOPOLL */
303
#define APR_ENOPOLL (APR_OS_START_ERROR + 10)
304
/** @see APR_STATUS_IS_ENOSOCKET */
305
#define APR_ENOSOCKET (APR_OS_START_ERROR + 11)
306
/** @see APR_STATUS_IS_ENOTHREAD */
307
#define APR_ENOTHREAD (APR_OS_START_ERROR + 12)
308
/** @see APR_STATUS_IS_ENOTHDKEY */
309
#define APR_ENOTHDKEY (APR_OS_START_ERROR + 13)
310
/** @see APR_STATUS_IS_EGENERAL */
311
#define APR_EGENERAL (APR_OS_START_ERROR + 14)
312
/** @see APR_STATUS_IS_ENOSHMAVAIL */
313
#define APR_ENOSHMAVAIL (APR_OS_START_ERROR + 15)
314
/** @see APR_STATUS_IS_EBADIP */
315
#define APR_EBADIP (APR_OS_START_ERROR + 16)
316
/** @see APR_STATUS_IS_EBADMASK */
317
#define APR_EBADMASK (APR_OS_START_ERROR + 17)
318
/* empty slot: +18 */
319
/** @see APR_STATUS_IS_EDSOPEN */
320
#define APR_EDSOOPEN (APR_OS_START_ERROR + 19)
321
/** @see APR_STATUS_IS_EABSOLUTE */
322
#define APR_EABSOLUTE (APR_OS_START_ERROR + 20)
323
/** @see APR_STATUS_IS_ERELATIVE */
324
#define APR_ERELATIVE (APR_OS_START_ERROR + 21)
325
/** @see APR_STATUS_IS_EINCOMPLETE */
326
#define APR_EINCOMPLETE (APR_OS_START_ERROR + 22)
327
/** @see APR_STATUS_IS_EABOVEROOT */
328
#define APR_EABOVEROOT (APR_OS_START_ERROR + 23)
329
/** @see APR_STATUS_IS_EBADPATH */
330
#define APR_EBADPATH (APR_OS_START_ERROR + 24)
331
/** @see APR_STATUS_IS_EPATHWILD */
332
#define APR_EPATHWILD (APR_OS_START_ERROR + 25)
333
/** @see APR_STATUS_IS_ESYMNOTFOUND */
334
#define APR_ESYMNOTFOUND (APR_OS_START_ERROR + 26)
335
/** @see APR_STATUS_IS_EPROC_UNKNOWN */
336
#define APR_EPROC_UNKNOWN (APR_OS_START_ERROR + 27)
337
/** @see APR_STATUS_IS_ENOTENOUGHENTROPY */
338
#define APR_ENOTENOUGHENTROPY (APR_OS_START_ERROR + 28)
342
* @defgroup APR_STATUS_IS Status Value Tests
343
* @warning For any particular error condition, more than one of these tests
344
* may match. This is because platform-specific error codes may not
345
* always match the semantics of the POSIX codes these tests (and the
346
* corresponding APR error codes) are named after. A notable example
347
* are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
348
* Win32 platforms. The programmer should always be aware of this and
349
* adjust the order of the tests accordingly.
353
* APR was unable to perform a stat on the file
354
* @warning always use this test, as platform-specific variances may meet this
355
* more than one error code
357
#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT)
359
* APR was not provided a pool with which to allocate memory
360
* @warning always use this test, as platform-specific variances may meet this
361
* more than one error code
363
#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL)
364
/** APR was given an invalid date */
365
#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE)
366
/** APR was given an invalid socket */
367
#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK)
368
/** APR was not given a process structure */
369
#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC)
370
/** APR was not given a time structure */
371
#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME)
372
/** APR was not given a directory structure */
373
#define APR_STATUS_IS_ENODIR(s) ((s) == APR_ENODIR)
374
/** APR was not given a lock structure */
375
#define APR_STATUS_IS_ENOLOCK(s) ((s) == APR_ENOLOCK)
376
/** APR was not given a poll structure */
377
#define APR_STATUS_IS_ENOPOLL(s) ((s) == APR_ENOPOLL)
378
/** APR was not given a socket */
379
#define APR_STATUS_IS_ENOSOCKET(s) ((s) == APR_ENOSOCKET)
380
/** APR was not given a thread structure */
381
#define APR_STATUS_IS_ENOTHREAD(s) ((s) == APR_ENOTHREAD)
382
/** APR was not given a thread key structure */
383
#define APR_STATUS_IS_ENOTHDKEY(s) ((s) == APR_ENOTHDKEY)
384
/** Generic Error which can not be put into another spot */
385
#define APR_STATUS_IS_EGENERAL(s) ((s) == APR_EGENERAL)
386
/** There is no more shared memory available */
387
#define APR_STATUS_IS_ENOSHMAVAIL(s) ((s) == APR_ENOSHMAVAIL)
388
/** The specified IP address is invalid */
389
#define APR_STATUS_IS_EBADIP(s) ((s) == APR_EBADIP)
390
/** The specified netmask is invalid */
391
#define APR_STATUS_IS_EBADMASK(s) ((s) == APR_EBADMASK)
392
/* empty slot: +18 */
394
* APR was unable to open the dso object.
395
* For more information call apr_dso_error().
398
#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \
399
|| APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
401
#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN)
403
/** The given path was absolute. */
404
#define APR_STATUS_IS_EABSOLUTE(s) ((s) == APR_EABSOLUTE)
405
/** The given path was relative. */
406
#define APR_STATUS_IS_ERELATIVE(s) ((s) == APR_ERELATIVE)
407
/** The given path was neither relative nor absolute. */
408
#define APR_STATUS_IS_EINCOMPLETE(s) ((s) == APR_EINCOMPLETE)
409
/** The given path was above the root path. */
410
#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT)
411
/** The given path was bad. */
412
#define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH)
413
/** The given path contained wildcards. */
414
#define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD)
415
/** Could not find the requested symbol.
416
* For more information call apr_dso_error().
419
#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \
420
|| APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
422
#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND)
424
/** The given process was not recognized by APR. */
425
#define APR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == APR_EPROC_UNKNOWN)
426
/** APR could not gather enough entropy to continue. */
427
#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
432
* @addtogroup APR_Error
435
/** @see APR_STATUS_IS_INCHILD */
436
#define APR_INCHILD (APR_OS_START_STATUS + 1)
437
/** @see APR_STATUS_IS_INPARENT */
438
#define APR_INPARENT (APR_OS_START_STATUS + 2)
439
/** @see APR_STATUS_IS_DETACH */
440
#define APR_DETACH (APR_OS_START_STATUS + 3)
441
/** @see APR_STATUS_IS_NOTDETACH */
442
#define APR_NOTDETACH (APR_OS_START_STATUS + 4)
443
/** @see APR_STATUS_IS_CHILD_DONE */
444
#define APR_CHILD_DONE (APR_OS_START_STATUS + 5)
445
/** @see APR_STATUS_IS_CHILD_NOTDONE */
446
#define APR_CHILD_NOTDONE (APR_OS_START_STATUS + 6)
447
/** @see APR_STATUS_IS_TIMEUP */
448
#define APR_TIMEUP (APR_OS_START_STATUS + 7)
449
/** @see APR_STATUS_IS_INCOMPLETE */
450
#define APR_INCOMPLETE (APR_OS_START_STATUS + 8)
452
/* empty slot: +10 */
453
/* empty slot: +11 */
454
/** @see APR_STATUS_IS_BADCH */
455
#define APR_BADCH (APR_OS_START_STATUS + 12)
456
/** @see APR_STATUS_IS_BADARG */
457
#define APR_BADARG (APR_OS_START_STATUS + 13)
458
/** @see APR_STATUS_IS_EOF */
459
#define APR_EOF (APR_OS_START_STATUS + 14)
460
/** @see APR_STATUS_IS_NOTFOUND */
461
#define APR_NOTFOUND (APR_OS_START_STATUS + 15)
462
/* empty slot: +16 */
463
/* empty slot: +17 */
464
/* empty slot: +18 */
465
/** @see APR_STATUS_IS_ANONYMOUS */
466
#define APR_ANONYMOUS (APR_OS_START_STATUS + 19)
467
/** @see APR_STATUS_IS_FILEBASED */
468
#define APR_FILEBASED (APR_OS_START_STATUS + 20)
469
/** @see APR_STATUS_IS_KEYBASED */
470
#define APR_KEYBASED (APR_OS_START_STATUS + 21)
471
/** @see APR_STATUS_IS_EINIT */
472
#define APR_EINIT (APR_OS_START_STATUS + 22)
473
/** @see APR_STATUS_IS_ENOTIMPL */
474
#define APR_ENOTIMPL (APR_OS_START_STATUS + 23)
475
/** @see APR_STATUS_IS_EMISMATCH */
476
#define APR_EMISMATCH (APR_OS_START_STATUS + 24)
477
/** @see APR_STATUS_IS_EBUSY */
478
#define APR_EBUSY (APR_OS_START_STATUS + 25)
482
* @addtogroup APR_STATUS_IS
486
* Program is currently executing in the child
488
* always use this test, as platform-specific variances may meet this
489
* more than one error code */
490
#define APR_STATUS_IS_INCHILD(s) ((s) == APR_INCHILD)
492
* Program is currently executing in the parent
494
* always use this test, as platform-specific variances may meet this
495
* more than one error code
497
#define APR_STATUS_IS_INPARENT(s) ((s) == APR_INPARENT)
499
* The thread is detached
501
* always use this test, as platform-specific variances may meet this
502
* more than one error code
504
#define APR_STATUS_IS_DETACH(s) ((s) == APR_DETACH)
506
* The thread is not detached
508
* always use this test, as platform-specific variances may meet this
509
* more than one error code
511
#define APR_STATUS_IS_NOTDETACH(s) ((s) == APR_NOTDETACH)
513
* The child has finished executing
515
* always use this test, as platform-specific variances may meet this
516
* more than one error code
518
#define APR_STATUS_IS_CHILD_DONE(s) ((s) == APR_CHILD_DONE)
520
* The child has not finished executing
522
* always use this test, as platform-specific variances may meet this
523
* more than one error code
525
#define APR_STATUS_IS_CHILD_NOTDONE(s) ((s) == APR_CHILD_NOTDONE)
527
* The operation did not finish before the timeout
529
* always use this test, as platform-specific variances may meet this
530
* more than one error code
532
#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP)
534
* The operation was incomplete although some processing was performed
535
* and the results are partially valid.
537
* always use this test, as platform-specific variances may meet this
538
* more than one error code
540
#define APR_STATUS_IS_INCOMPLETE(s) ((s) == APR_INCOMPLETE)
542
/* empty slot: +10 */
543
/* empty slot: +11 */
545
* Getopt found an option not in the option string
547
* always use this test, as platform-specific variances may meet this
548
* more than one error code
550
#define APR_STATUS_IS_BADCH(s) ((s) == APR_BADCH)
552
* Getopt found an option not in the option string and an argument was
553
* specified in the option string
555
* always use this test, as platform-specific variances may meet this
556
* more than one error code
558
#define APR_STATUS_IS_BADARG(s) ((s) == APR_BADARG)
560
* APR has encountered the end of the file
562
* always use this test, as platform-specific variances may meet this
563
* more than one error code
565
#define APR_STATUS_IS_EOF(s) ((s) == APR_EOF)
567
* APR was unable to find the socket in the poll structure
569
* always use this test, as platform-specific variances may meet this
570
* more than one error code
572
#define APR_STATUS_IS_NOTFOUND(s) ((s) == APR_NOTFOUND)
573
/* empty slot: +16 */
574
/* empty slot: +17 */
575
/* empty slot: +18 */
577
* APR is using anonymous shared memory
579
* always use this test, as platform-specific variances may meet this
580
* more than one error code
582
#define APR_STATUS_IS_ANONYMOUS(s) ((s) == APR_ANONYMOUS)
584
* APR is using a file name as the key to the shared memory
586
* always use this test, as platform-specific variances may meet this
587
* more than one error code
589
#define APR_STATUS_IS_FILEBASED(s) ((s) == APR_FILEBASED)
591
* APR is using a shared key as the key to the shared memory
593
* always use this test, as platform-specific variances may meet this
594
* more than one error code
596
#define APR_STATUS_IS_KEYBASED(s) ((s) == APR_KEYBASED)
598
* Ininitalizer value. If no option has been found, but
599
* the status variable requires a value, this should be used
601
* always use this test, as platform-specific variances may meet this
602
* more than one error code
604
#define APR_STATUS_IS_EINIT(s) ((s) == APR_EINIT)
606
* The APR function has not been implemented on this
607
* platform, either because nobody has gotten to it yet,
608
* or the function is impossible on this platform.
610
* always use this test, as platform-specific variances may meet this
611
* more than one error code
613
#define APR_STATUS_IS_ENOTIMPL(s) ((s) == APR_ENOTIMPL)
615
* Two passwords do not match.
617
* always use this test, as platform-specific variances may meet this
618
* more than one error code
620
#define APR_STATUS_IS_EMISMATCH(s) ((s) == APR_EMISMATCH)
622
* The given lock was busy
623
* @warning always use this test, as platform-specific variances may meet this
624
* more than one error code
626
#define APR_STATUS_IS_EBUSY(s) ((s) == APR_EBUSY)
631
* @addtogroup APR_Error APR Error Values
634
/* APR CANONICAL ERROR VALUES */
635
/** @see APR_STATUS_IS_EACCES */
637
#define APR_EACCES EACCES
639
#define APR_EACCES (APR_OS_START_CANONERR + 1)
642
/** @see APR_STATUS_IS_EEXIST */
644
#define APR_EEXIST EEXIST
646
#define APR_EEXIST (APR_OS_START_CANONERR + 2)
649
/** @see APR_STATUS_IS_ENAMETOOLONG */
651
#define APR_ENAMETOOLONG ENAMETOOLONG
653
#define APR_ENAMETOOLONG (APR_OS_START_CANONERR + 3)
656
/** @see APR_STATUS_IS_ENOENT */
658
#define APR_ENOENT ENOENT
660
#define APR_ENOENT (APR_OS_START_CANONERR + 4)
663
/** @see APR_STATUS_IS_ENOTDIR */
665
#define APR_ENOTDIR ENOTDIR
667
#define APR_ENOTDIR (APR_OS_START_CANONERR + 5)
670
/** @see APR_STATUS_IS_ENOSPC */
672
#define APR_ENOSPC ENOSPC
674
#define APR_ENOSPC (APR_OS_START_CANONERR + 6)
677
/** @see APR_STATUS_IS_ENOMEM */
679
#define APR_ENOMEM ENOMEM
681
#define APR_ENOMEM (APR_OS_START_CANONERR + 7)
684
/** @see APR_STATUS_IS_EMFILE */
686
#define APR_EMFILE EMFILE
688
#define APR_EMFILE (APR_OS_START_CANONERR + 8)
691
/** @see APR_STATUS_IS_ENFILE */
693
#define APR_ENFILE ENFILE
695
#define APR_ENFILE (APR_OS_START_CANONERR + 9)
698
/** @see APR_STATUS_IS_EBADF */
700
#define APR_EBADF EBADF
702
#define APR_EBADF (APR_OS_START_CANONERR + 10)
705
/** @see APR_STATUS_IS_EINVAL */
707
#define APR_EINVAL EINVAL
709
#define APR_EINVAL (APR_OS_START_CANONERR + 11)
712
/** @see APR_STATUS_IS_ESPIPE */
714
#define APR_ESPIPE ESPIPE
716
#define APR_ESPIPE (APR_OS_START_CANONERR + 12)
720
* @see APR_STATUS_IS_EAGAIN
721
* @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
724
#define APR_EAGAIN EAGAIN
725
#elif defined(EWOULDBLOCK)
726
#define APR_EAGAIN EWOULDBLOCK
728
#define APR_EAGAIN (APR_OS_START_CANONERR + 13)
731
/** @see APR_STATUS_IS_EINTR */
733
#define APR_EINTR EINTR
735
#define APR_EINTR (APR_OS_START_CANONERR + 14)
738
/** @see APR_STATUS_IS_ENOTSOCK */
740
#define APR_ENOTSOCK ENOTSOCK
742
#define APR_ENOTSOCK (APR_OS_START_CANONERR + 15)
745
/** @see APR_STATUS_IS_ECONNREFUSED */
747
#define APR_ECONNREFUSED ECONNREFUSED
749
#define APR_ECONNREFUSED (APR_OS_START_CANONERR + 16)
752
/** @see APR_STATUS_IS_EINPROGRESS */
754
#define APR_EINPROGRESS EINPROGRESS
756
#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17)
760
* @see APR_STATUS_IS_ECONNABORTED
761
* @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
765
#define APR_ECONNABORTED ECONNABORTED
767
#define APR_ECONNABORTED (APR_OS_START_CANONERR + 18)
770
/** @see APR_STATUS_IS_ECONNRESET */
772
#define APR_ECONNRESET ECONNRESET
774
#define APR_ECONNRESET (APR_OS_START_CANONERR + 19)
777
/** @see APR_STATUS_IS_ETIMEDOUT
780
#define APR_ETIMEDOUT ETIMEDOUT
782
#define APR_ETIMEDOUT (APR_OS_START_CANONERR + 20)
785
/** @see APR_STATUS_IS_EHOSTUNREACH */
787
#define APR_EHOSTUNREACH EHOSTUNREACH
789
#define APR_EHOSTUNREACH (APR_OS_START_CANONERR + 21)
792
/** @see APR_STATUS_IS_ENETUNREACH */
794
#define APR_ENETUNREACH ENETUNREACH
796
#define APR_ENETUNREACH (APR_OS_START_CANONERR + 22)
799
/** @see APR_STATUS_IS_EFTYPE */
801
#define APR_EFTYPE EFTYPE
803
#define APR_EFTYPE (APR_OS_START_CANONERR + 23)
806
/** @see APR_STATUS_IS_EPIPE */
808
#define APR_EPIPE EPIPE
810
#define APR_EPIPE (APR_OS_START_CANONERR + 24)
813
/** @see APR_STATUS_IS_EXDEV */
815
#define APR_EXDEV EXDEV
817
#define APR_EXDEV (APR_OS_START_CANONERR + 25)
820
/** @see APR_STATUS_IS_ENOTEMPTY */
822
#define APR_ENOTEMPTY ENOTEMPTY
824
#define APR_ENOTEMPTY (APR_OS_START_CANONERR + 26)
827
/** @see APR_STATUS_IS_EAFNOSUPPORT */
829
#define APR_EAFNOSUPPORT EAFNOSUPPORT
831
#define APR_EAFNOSUPPORT (APR_OS_START_CANONERR + 27)
836
#if defined(OS2) && !defined(DOXYGEN)
838
#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
839
#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
841
#define INCL_DOSERRORS
844
/* Leave these undefined.
845
* OS2 doesn't rely on the errno concept.
846
* The API calls always return a result codes which
847
* should be filtered through APR_FROM_OS_ERROR().
849
* #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
850
* #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
853
/* A special case, only socket calls require this;
855
#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno))
856
#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e))
858
/* And this needs to be greped away for good:
860
#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
862
/* These can't sit in a private header, so in spite of the extra size,
863
* they need to be made available here.
865
#define SOCBASEERR 10000
866
#define SOCEPERM (SOCBASEERR+1) /* Not owner */
867
#define SOCESRCH (SOCBASEERR+3) /* No such process */
868
#define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */
869
#define SOCENXIO (SOCBASEERR+6) /* No such device or address */
870
#define SOCEBADF (SOCBASEERR+9) /* Bad file number */
871
#define SOCEACCES (SOCBASEERR+13) /* Permission denied */
872
#define SOCEFAULT (SOCBASEERR+14) /* Bad address */
873
#define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */
874
#define SOCEMFILE (SOCBASEERR+24) /* Too many open files */
875
#define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */
876
#define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */
877
#define SOCEWOULDBLOCK (SOCBASEERR+35) /* Operation would block */
878
#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */
879
#define SOCEALREADY (SOCBASEERR+37) /* Operation already in progress */
880
#define SOCENOTSOCK (SOCBASEERR+38) /* Socket operation on non-socket */
881
#define SOCEDESTADDRREQ (SOCBASEERR+39) /* Destination address required */
882
#define SOCEMSGSIZE (SOCBASEERR+40) /* Message too long */
883
#define SOCEPROTOTYPE (SOCBASEERR+41) /* Protocol wrong type for socket */
884
#define SOCENOPROTOOPT (SOCBASEERR+42) /* Protocol not available */
885
#define SOCEPROTONOSUPPORT (SOCBASEERR+43) /* Protocol not supported */
886
#define SOCESOCKTNOSUPPORT (SOCBASEERR+44) /* Socket type not supported */
887
#define SOCEOPNOTSUPP (SOCBASEERR+45) /* Operation not supported on socket */
888
#define SOCEPFNOSUPPORT (SOCBASEERR+46) /* Protocol family not supported */
889
#define SOCEAFNOSUPPORT (SOCBASEERR+47) /* Address family not supported by protocol family */
890
#define SOCEADDRINUSE (SOCBASEERR+48) /* Address already in use */
891
#define SOCEADDRNOTAVAIL (SOCBASEERR+49) /* Can't assign requested address */
892
#define SOCENETDOWN (SOCBASEERR+50) /* Network is down */
893
#define SOCENETUNREACH (SOCBASEERR+51) /* Network is unreachable */
894
#define SOCENETRESET (SOCBASEERR+52) /* Network dropped connection on reset */
895
#define SOCECONNABORTED (SOCBASEERR+53) /* Software caused connection abort */
896
#define SOCECONNRESET (SOCBASEERR+54) /* Connection reset by peer */
897
#define SOCENOBUFS (SOCBASEERR+55) /* No buffer space available */
898
#define SOCEISCONN (SOCBASEERR+56) /* Socket is already connected */
899
#define SOCENOTCONN (SOCBASEERR+57) /* Socket is not connected */
900
#define SOCESHUTDOWN (SOCBASEERR+58) /* Can't send after socket shutdown */
901
#define SOCETOOMANYREFS (SOCBASEERR+59) /* Too many references: can't splice */
902
#define SOCETIMEDOUT (SOCBASEERR+60) /* Connection timed out */
903
#define SOCECONNREFUSED (SOCBASEERR+61) /* Connection refused */
904
#define SOCELOOP (SOCBASEERR+62) /* Too many levels of symbolic links */
905
#define SOCENAMETOOLONG (SOCBASEERR+63) /* File name too long */
906
#define SOCEHOSTDOWN (SOCBASEERR+64) /* Host is down */
907
#define SOCEHOSTUNREACH (SOCBASEERR+65) /* No route to host */
908
#define SOCENOTEMPTY (SOCBASEERR+66) /* Directory not empty */
910
/* APR CANONICAL ERROR TESTS */
911
#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
912
|| (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
913
|| (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
914
#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
915
|| (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
916
|| (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
917
|| (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
918
|| (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
919
#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
920
|| (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
921
|| (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
922
#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
923
|| (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
924
|| (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
925
|| (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
926
|| (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
927
#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
928
#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
929
|| (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
930
#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
931
#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
932
|| (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
933
#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
934
#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
935
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
936
#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
937
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
938
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
939
#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
940
|| (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
941
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
942
|| (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
943
|| (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
944
|| (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
945
#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
946
|| (s) == APR_OS_START_SYSERR + SOCEINTR)
947
#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
948
|| (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
949
#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
950
|| (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
951
#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
952
|| (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
953
#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
954
|| (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
955
#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
956
|| (s) == APR_OS_START_SYSERR + SOCECONNRESET)
958
#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
959
|| (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
960
#undef APR_STATUS_IS_TIMEUP
961
#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
962
|| (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
963
#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
964
|| (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
965
#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
966
|| (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
967
#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
968
#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
969
|| (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
970
|| (s) == APR_OS_START_SYSERR + SOCEPIPE)
971
#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
972
|| (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
973
#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
974
|| (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
975
|| (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
976
#define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_AFNOSUPPORT \
977
|| (s) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT)
980
Sorry, too tired to wrap this up for OS2... feel free to
981
fit the following into their best matches.
983
{ ERROR_NO_SIGNAL_SENT, ESRCH },
984
{ SOCEALREADY, EALREADY },
985
{ SOCEDESTADDRREQ, EDESTADDRREQ },
986
{ SOCEMSGSIZE, EMSGSIZE },
987
{ SOCEPROTOTYPE, EPROTOTYPE },
988
{ SOCENOPROTOOPT, ENOPROTOOPT },
989
{ SOCEPROTONOSUPPORT, EPROTONOSUPPORT },
990
{ SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT },
991
{ SOCEOPNOTSUPP, EOPNOTSUPP },
992
{ SOCEPFNOSUPPORT, EPFNOSUPPORT },
993
{ SOCEADDRINUSE, EADDRINUSE },
994
{ SOCEADDRNOTAVAIL, EADDRNOTAVAIL },
995
{ SOCENETDOWN, ENETDOWN },
996
{ SOCENETRESET, ENETRESET },
997
{ SOCENOBUFS, ENOBUFS },
998
{ SOCEISCONN, EISCONN },
999
{ SOCENOTCONN, ENOTCONN },
1000
{ SOCESHUTDOWN, ESHUTDOWN },
1001
{ SOCETOOMANYREFS, ETOOMANYREFS },
1002
{ SOCELOOP, ELOOP },
1003
{ SOCEHOSTDOWN, EHOSTDOWN },
1004
{ SOCENOTEMPTY, ENOTEMPTY },
1008
#elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */
1010
#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
1011
#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
1013
#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
1014
#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
1016
/* A special case, only socket calls require this:
1018
#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
1019
#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
1021
/* APR CANONICAL ERROR TESTS */
1022
#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
1023
|| (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
1024
|| (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
1025
|| (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
1026
|| (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
1027
|| (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
1028
|| (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
1029
|| (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
1030
|| (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
1031
|| (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
1032
|| (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
1033
#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
1034
|| (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
1035
|| (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
1036
#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
1037
|| (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
1038
|| (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
1039
#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
1040
|| (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
1041
|| (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
1042
|| (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
1043
|| (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
1044
#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR \
1045
|| (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
1046
|| (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
1047
|| (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
1048
|| (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
1049
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE \
1050
|| (s) == APR_OS_START_SYSERR + ERROR_DIRECTORY)
1051
#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
1052
|| (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
1053
#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM \
1054
|| (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
1055
|| (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
1056
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
1057
|| (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
1058
|| (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
1059
#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
1060
|| (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
1061
#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
1062
#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
1063
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
1064
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
1065
#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
1066
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
1067
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
1068
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
1069
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
1070
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
1071
|| (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
1072
#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
1073
|| (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
1074
|| (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
1075
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
1076
|| (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
1077
|| (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
1078
|| (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
1079
|| (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
1080
|| (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
1081
|| (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
1082
#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
1083
|| (s) == APR_OS_START_SYSERR + WSAEINTR)
1084
#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
1085
|| (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
1086
#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
1087
|| (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
1088
#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
1089
|| (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
1090
#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
1091
|| (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
1092
#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
1093
|| (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
1094
|| (s) == APR_OS_START_SYSERR + WSAECONNRESET)
1095
/* XXX deprecated */
1096
#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
1097
|| (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1098
|| (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
1099
#undef APR_STATUS_IS_TIMEUP
1100
#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
1101
|| (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1102
|| (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
1103
#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
1104
|| (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
1105
#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
1106
|| (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
1107
#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE \
1108
|| (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
1109
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
1110
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
1111
|| (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
1112
|| (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
1113
|| (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
1114
|| (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
1115
#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
1116
|| (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
1117
#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
1118
|| (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
1119
#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
1120
|| (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
1121
#define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT \
1122
|| (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
1124
#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
1126
#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
1127
#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
1129
#define apr_get_os_error() (errno)
1130
#define apr_set_os_error(e) (errno = (e))
1132
/* A special case, only socket calls require this: */
1133
#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
1134
#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
1136
/* APR CANONICAL ERROR TESTS */
1137
#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
1138
#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
1139
#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
1140
#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
1141
#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
1142
#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
1143
#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
1144
#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
1145
#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
1146
#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
1147
#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
1148
#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
1150
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
1151
|| (s) == EWOULDBLOCK \
1152
|| (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
1153
#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
1154
|| (s) == APR_OS_START_SYSERR + WSAEINTR)
1155
#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
1156
|| (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
1157
#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
1158
|| (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
1159
#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
1160
|| (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
1161
#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
1162
|| (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
1163
#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
1164
|| (s) == APR_OS_START_SYSERR + WSAECONNRESET)
1165
/* XXX deprecated */
1166
#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
1167
|| (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1168
|| (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
1169
#undef APR_STATUS_IS_TIMEUP
1170
#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
1171
|| (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1172
|| (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
1173
#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
1174
|| (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
1175
#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
1176
|| (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
1177
#define APR_STATUS_IS_ENETDOWN(s) ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
1178
#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
1179
#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
1180
#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
1181
#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY)
1182
#define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT \
1183
|| (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
1185
#else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
1188
* os error codes are clib error codes
1190
#define APR_FROM_OS_ERROR(e) (e)
1191
#define APR_TO_OS_ERROR(e) (e)
1193
#define apr_get_os_error() (errno)
1194
#define apr_set_os_error(e) (errno = (e))
1196
/* A special case, only socket calls require this:
1198
#define apr_get_netos_error() (errno)
1199
#define apr_set_netos_error(e) (errno = (e))
1202
* @addtogroup APR_STATUS_IS
1206
/** permission denied */
1207
#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
1209
#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
1210
/** path name is too long */
1211
#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
1213
* no such file or directory
1215
* EMVSCATLG can be returned by the automounter on z/OS for
1216
* paths which do not exist.
1219
#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
1220
|| (s) == EMVSCATLG)
1222
#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
1224
/** not a directory */
1225
#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
1226
/** no space left on device */
1228
#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
1231
#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
1233
/** not enough memory */
1234
#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
1235
/** too many open files */
1236
#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
1237
/** file table overflow */
1238
#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
1240
#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
1241
/** invalid argument */
1242
#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
1244
#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
1246
/** operation would block */
1247
#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
1248
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
1249
#elif (EWOULDBLOCK == EAGAIN)
1250
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
1252
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
1253
|| (s) == EWOULDBLOCK)
1256
/** interrupted system call */
1257
#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR)
1258
/** socket operation on a non-socket */
1259
#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK)
1260
/** Connection Refused */
1261
#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED)
1262
/** operation now in progress */
1263
#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS)
1266
* Software caused connection abort
1268
* EPROTO on certain older kernels really means ECONNABORTED, so we need to
1269
* ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603
1271
* There is potentially a bug in Solaris 2.x x<6, and other boxes that
1272
* implement tcp sockets in userland (i.e. on top of STREAMS). On these
1273
* systems, EPROTO can actually result in a fatal loop. See PR#981 for
1274
* example. It's hard to handle both uses of EPROTO.
1277
#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
1280
#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED)
1283
/** Connection Reset by peer */
1284
#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET)
1285
/** Operation timed out
1287
#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT)
1288
/** no route to host */
1289
#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH)
1290
/** network is unreachable */
1291
#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH)
1292
/** inappropiate file type or format */
1293
#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
1295
#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
1296
/** cross device link */
1297
#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
1298
/** Directory Not Empty */
1299
#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY || \
1301
/** Address Family not supported */
1302
#define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT)
1305
#endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
1313
#endif /* ! APR_ERRNO_H */