apr_errno.inc 49 KB

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