apr_errno.inc 48 KB

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