apr_errno.h 54 KB

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