apr_portable.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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. { This header file is where you should put ANY platform specific information.
  17. * This should be the only header file that programs need to include that
  18. * actually has platform dependant code which refers to the .
  19. }
  20. {
  21. * @file apr_portable.h
  22. * @brief APR Portability Routines
  23. }
  24. {#include "apr.h"
  25. #include "apr_pools.h"
  26. #include "apr_thread_proc.h"
  27. #include "apr_file_io.h"
  28. #include "apr_network_io.h"
  29. #include "apr_errno.h"
  30. #include "apr_global_mutex.h"
  31. #include "apr_proc_mutex.h"
  32. #include "apr_time.h"
  33. #include "apr_dso.h"
  34. #include "apr_shm.h"
  35. #if APR_HAVE_DIRENT_H
  36. #include <dirent.h>
  37. #endif
  38. #if APR_HAVE_FCNTL_H
  39. #include <fcntl.h>
  40. #endif
  41. #if APR_HAVE_PTHREAD_H
  42. #include <pthread.h>
  43. #endif}
  44. {
  45. * @defgroup apr_portabile Portability Routines
  46. * @ingroup APR
  47. }
  48. type
  49. {$ifdef WINDOWS}
  50. { The primitives for Windows types }
  51. apr_os_file_t = THandle;
  52. apr_os_dir_t = THandle;
  53. apr_os_sock_t = TSocket;
  54. apr_os_proc_mutex_t = THandle;
  55. apr_os_thread_t = THandle;
  56. apr_os_proc_t = THandle;
  57. apr_os_threadkey_t = Cardinal;
  58. apr_os_imp_time_t = TFILETIME;
  59. apr_os_exp_time_t = TSYSTEMTIME;
  60. apr_os_dso_handle_t = THandle;
  61. apr_os_shm_t = THandle;
  62. {$else}
  63. {$ifdef OS2}
  64. HFILE apr_os_file_t;
  65. HDIR apr_os_dir_t;
  66. int apr_os_sock_t;
  67. HMTX apr_os_proc_mutex_t;
  68. TID apr_os_thread_t;
  69. PID apr_os_proc_t;
  70. PULONG apr_os_threadkey_t;
  71. struct timeval apr_os_imp_time_t;
  72. struct tm apr_os_exp_time_t;
  73. HMODULE apr_os_dso_handle_t;
  74. apr_os_shm_t: Pointer;
  75. {$else}
  76. {$ifdef BEOS}
  77. #include <kernel/OS.h>
  78. #include <kernel/image.h>
  79. apr_os_proc_mutex_t = record
  80. sem_id sem;
  81. int32 ben;
  82. end;
  83. apr_os_file_t: cint;
  84. DIR apr_os_dir_t;
  85. apr_os_sock_t: cint;
  86. struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
  87. thread_id apr_os_thread_t;
  88. thread_id apr_os_proc_t;
  89. apr_os_threadkey_t: cint;
  90. struct timeval apr_os_imp_time_t;
  91. struct tm apr_os_exp_time_t;
  92. image_id apr_os_dso_handle_t;
  93. apr_os_shm_t: Pointer;
  94. {$else}
  95. {$ifdef NETWARE}
  96. apr_os_file_t: cint;
  97. DIR apr_os_dir_t;
  98. apr_os_sock_t: cint;
  99. NXMutex_t apr_os_proc_mutex_t;
  100. NXThreadId_t apr_os_thread_t;
  101. long apr_os_proc_t;
  102. NXKey_t apr_os_threadkey_t;
  103. struct timeval apr_os_imp_time_t;
  104. struct tm apr_os_exp_time_t;
  105. apr_os_dso_handle_t: Pointer;
  106. apr_os_shm_t: Pointer;
  107. {$else}
  108. { Any other OS should go above this one. This is the lowest common
  109. * denominator typedefs for all UNIX-like systems. :)
  110. }
  111. { Basic OS process mutex structure. }
  112. apr_os_proc_mutex_t = record
  113. {$if defined(APR_HAS_SYSVSEM_SERIALIZE) or defined(APR_HAS_FCNTL_SERIALIZE) or defined(APR_HAS_FLOCK_SERIALIZE)}
  114. crossproc: Integer;
  115. {$endif}
  116. {$ifdef APR_HAS_PROC_PTHREAD_SERIALIZE}
  117. pthread_mutex_t *pthread_interproc;
  118. {$endif}
  119. {$ifdef APR_HAS_THREADS}
  120. { If no threads, no need for thread locks }
  121. {$if APR_USE_PTHREAD_SERIALIZE}
  122. pthread_mutex_t *intraproc;
  123. {$endif}
  124. {$endif}
  125. end;
  126. apr_os_file_t: Integer; {< native file }
  127. typedef DIR apr_os_dir_t; {< native dir }
  128. apr_os_sock_t: Integer; {< native dir }
  129. typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; {< native proces
  130. * mutex
  131. }
  132. {$if defined(APR_HAS_THREADS) and defined(APR_HAVE_PTHREAD_H)}
  133. typedef pthread_t apr_os_thread_t; {< native thread }
  134. typedef pthread_key_t apr_os_threadkey_t; {< native thread address
  135. * space }
  136. {$endif}
  137. typedef pid_t apr_os_proc_t; {< native pid }
  138. typedef struct timeval apr_os_imp_time_t; {< native timeval }
  139. typedef struct tm apr_os_exp_time_t; {< native tm }
  140. { @var apr_os_dso_handle_t
  141. * native dso types
  142. }
  143. {$ifdef HPUX}
  144. #include <dl.h>
  145. typedef shl_t apr_os_dso_handle_t;
  146. {$else}
  147. {$ifdef DARWIN}
  148. #include <mach-o/dyld.h>
  149. typedef NSModule apr_os_dso_handle_t;
  150. {$else}
  151. typedef void * apr_os_dso_handle_t;
  152. {$endif}
  153. {$endif}
  154. typedef void* apr_os_shm_t; {< native SHM }
  155. {$endif}
  156. {$endif}
  157. {$endif}
  158. {$endif}
  159. Papr_os_sock_t = ^apr_os_sock_t;
  160. {
  161. * @typedef apr_os_sock_info_t
  162. * @brief alias for local OS socket
  163. }
  164. {
  165. * everything APR needs to know about an active socket to construct
  166. * an APR socket from it; currently, this is platform-independent
  167. }
  168. apr_os_sock_info_t = record
  169. os_sock: Papr_os_sock_t; {< always required }
  170. local: Psockaddr; {< NULL if not yet bound }
  171. remote: Psockaddr; {< NULL if not connected }
  172. family: Integer; {< always required (APR_INET, APR_INET6, etc.) }
  173. type_: Integer; {< always required (SOCK_STREAM, SOCK_DGRAM, etc.) }
  174. protocol: Integer; {< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) }
  175. end;
  176. Papr_os_sock_info_t = ^apr_os_sock_info_t;
  177. {$if defined(APR_PROC_MUTEX_IS_GLOBAL) or defined(DOXYGEN)}
  178. { Opaque global mutex type }
  179. #define apr_os_global_mutex_t apr_os_proc_mutex_t
  180. { @return apr_os_global_mutex }
  181. #define apr_os_global_mutex_get apr_os_proc_mutex_get
  182. {$else}
  183. { Thread and process mutex for those platforms where process mutexes
  184. * are not held in threads.
  185. }
  186. apr_os_global_mutex_t = record
  187. pool: Papr_pool_t;
  188. proc_mutex: Papr_proc_mutex_t;
  189. #if APR_HAS_THREADS
  190. thread_mutex: Papr_proc_mutex_t;
  191. #endif { APR_HAS_THREADS }
  192. end;
  193. Papr_os_global_mutex_t = ^apr_os_global_mutex_t;
  194. APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
  195. apr_global_mutex_t *pmutex);
  196. {$endif}
  197. {
  198. * convert the file from apr type to os specific type.
  199. * @param thefile The os specific file we are converting to
  200. * @param file The apr file to convert.
  201. * @remark On Unix, it is only possible to get a file descriptor from
  202. * an apr file type.
  203. }
  204. function apr_os_file_get(thefile, file_: Papr_os_file_t): apr_status_t;
  205. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  206. external LibAPR name LibNamePrefix + 'apr_os_file_get' + LibSuff8;
  207. {
  208. * convert the dir from apr type to os specific type.
  209. * @param thedir The os specific dir we are converting to
  210. * @param dir The apr dir to convert.
  211. }
  212. function apr_os_dir_get(thedir: PPapr_os_dir_t; dir: Papr_dir_t): apr_status_t;
  213. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  214. external LibAPR name LibNamePrefix + 'apr_os_dir_get' + LibSuff8;
  215. {
  216. * Convert the socket from an apr type to an OS specific socket
  217. * @param thesock The socket to convert.
  218. * @param sock The os specifc equivelant of the apr socket..
  219. }
  220. function apr_os_sock_get(thesock, sock: Papr_os_sock_t): apr_status_t;
  221. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  222. external LibAPR name LibNamePrefix + 'apr_os_sock_get' + LibSuff8;
  223. {
  224. * Convert the proc mutex from os specific type to apr type
  225. * @param ospmutex The os specific proc mutex we are converting to.
  226. * @param pmutex The apr proc mutex to convert.
  227. }
  228. function apr_os_proc_mutex_get(ospmutex: Papr_os_proc_mutex_t;
  229. pmutex: Papr_proc_mutex_t): apr_status_t;
  230. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  231. external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_get' + LibSuff8;
  232. {
  233. * Get the exploded time in the platforms native format.
  234. * @param ostime the native time format
  235. * @param aprtime the time to convert
  236. }
  237. function apr_os_exp_time_get(ostime: PPapr_os_exp_time_t;
  238. aprtime: Papr_time_exp_t): apr_status_t;
  239. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  240. external LibAPR name LibNamePrefix + 'apr_os_exp_time_get' + LibSuff8;
  241. {
  242. * Get the imploded time in the platforms native format.
  243. * @param ostime the native time format
  244. * @param aprtime the time to convert
  245. }
  246. function apr_os_imp_time_get(ostime: PPapr_os_imp_time_t;
  247. aprtime: Papr_time_t): apr_status_t;
  248. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  249. external LibAPR name LibNamePrefix + 'apr_os_imp_time_get' + LibSuff8;
  250. {
  251. * convert the shm from apr type to os specific type.
  252. * @param osshm The os specific shm representation
  253. * @param shm The apr shm to convert.
  254. }
  255. function apr_os_shm_get(osshm: Papr_os_shm_t; shm: Papr_shm_t): apr_status_t;
  256. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  257. external LibAPR name LibNamePrefix + 'apr_os_shm_get' + LibSuff8;
  258. {$if defined(APR_HAS_THREADS) or defined(DOXYGEN)}
  259. {
  260. * @defgroup apr_os_thread Thread portability Routines
  261. }
  262. {
  263. * convert the thread to os specific type from apr type.
  264. * @param thethd The apr thread to convert
  265. * @param thd The os specific thread we are converting to
  266. }
  267. function apr_os_thread_get(thethd: PPapr_os_thread_t;
  268. thd: Papr_thread_t): apr_status_t;
  269. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  270. external LibAPR name LibNamePrefix + 'apr_os_thread_get' + LibSuff8;
  271. {
  272. * convert the thread private memory key to os specific type from an apr type.
  273. * @param thekey The apr handle we are converting from.
  274. * @param key The os specific handle we are converting to.
  275. }
  276. function apr_os_threadkey_get(thekey: Papr_os_threadkey_t;
  277. key: Papr_threadkey_t): apr_status_t;
  278. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  279. external LibAPR name LibNamePrefix + 'apr_os_threadkey_get' + LibSuff8;
  280. {
  281. * convert the thread from os specific type to apr type.
  282. * @param thd The apr thread we are converting to.
  283. * @param thethd The os specific thread to convert
  284. * @param cont The pool to use if it is needed.
  285. }
  286. function apr_os_thread_put(thd: PPapr_thread_t;
  287. thethd: Papr_os_thread_t; cont: Papr_pool_t): apr_status_t;
  288. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  289. external LibAPR name LibNamePrefix + 'apr_os_thread_put' + LibSuff12;
  290. {
  291. * convert the thread private memory key from os specific type to apr type.
  292. * @param key The apr handle we are converting to.
  293. * @param thekey The os specific handle to convert
  294. * @param cont The pool to use if it is needed.
  295. }
  296. function apr_os_threadkey_put(key: PPapr_threadkey_t;
  297. thekey: Papr_os_threadkey_t; cont: Papr_pool_t): apr_status_t;
  298. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  299. external LibAPR name LibNamePrefix + 'apr_os_threadkey_put' + LibSuff12;
  300. {
  301. * Get the thread ID
  302. }
  303. function apr_os_thread_current: apr_os_thread_t;
  304. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  305. external LibAPR name LibNamePrefix + 'apr_os_thread_current' + LibSuff0;
  306. {
  307. * Compare two thread id's
  308. * @param tid1 1st Thread ID to compare
  309. * @param tid2 2nd Thread ID to compare
  310. }
  311. function apr_os_thread_equal(tid1, tid2: apr_os_thread_t): Integer;
  312. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  313. external LibAPR name LibNamePrefix + 'apr_os_thread_equal' + LibSuff8;
  314. {$endif} { APR_HAS_THREADS }
  315. {
  316. * convert the file from os specific type to apr type.
  317. * @param file The apr file we are converting to.
  318. * @param thefile The os specific file to convert
  319. * @param flags The flags that were used to open this file.
  320. * @param cont The pool to use if it is needed.
  321. * @remark On Unix, it is only possible to put a file descriptor into
  322. * an apr file type.
  323. }
  324. function apr_os_file_put(file_: PPapr_file_t;
  325. pthefilemutex: Papr_os_file_t; flags: apr_int32_t; cont: Papr_pool_t): apr_status_t;
  326. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  327. external LibAPR name LibNamePrefix + 'apr_os_file_put' + LibSuff16;
  328. {
  329. * convert the file from os specific type to apr type.
  330. * @param file The apr file we are converting to.
  331. * @param thefile The os specific pipe to convert
  332. * @param cont The pool to use if it is needed.
  333. * @remark On Unix, it is only possible to put a file descriptor into
  334. * an apr file type.
  335. }
  336. function apr_os_pipe_put(file_: PPapr_file_t;
  337. thefile: Papr_os_file_t; cont: Papr_pool_t): apr_status_t;
  338. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  339. external LibAPR name LibNamePrefix + 'apr_os_pipe_put' + LibSuff12;
  340. {
  341. * convert the file from os specific type to apr type.
  342. * @param file The apr file we are converting to.
  343. * @param thefile The os specific pipe to convert
  344. * @param register_cleanup A cleanup will be registered on the apr_file_t
  345. * to issue apr_file_close().
  346. * @param cont The pool to use if it is needed.
  347. * @remark On Unix, it is only possible to put a file descriptor into
  348. * an apr file type.
  349. }
  350. function apr_os_pipe_put_ex(file_: PPapr_file_t;
  351. thefile: Papr_os_file_t; register_cleanup: Integer;
  352. cont: Papr_pool_t): apr_status_t;
  353. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  354. external LibAPR name LibNamePrefix + 'apr_os_pipe_put_ex' + LibSuff16;
  355. {
  356. * convert the dir from os specific type to apr type.
  357. * @param dir The apr dir we are converting to.
  358. * @param thedir The os specific dir to convert
  359. * @param cont The pool to use when creating to apr directory.
  360. }
  361. function apr_os_dir_put(dir: PPapr_dir_t; thedir: Papr_os_dir_t;
  362. cont: Papr_pool_t): apr_status_t;
  363. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  364. external LibAPR name LibNamePrefix + 'apr_os_dir_put' + LibSuff12;
  365. {
  366. * Convert a socket from the os specific type to the apr type
  367. * @param sock The pool to use.
  368. * @param thesock The socket to convert to.
  369. * @param cont The socket we are converting to an apr type.
  370. * @remark If it is a true socket, it is best to call apr_os_sock_make()
  371. * and provide APR with more information about the socket.
  372. }
  373. function apr_os_sock_put(sock: PPapr_socket_t; thesock: Papr_socket_t;
  374. cont: Papr_pool_t): apr_status_t;
  375. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  376. external LibAPR name LibNamePrefix + 'apr_os_sock_put' + LibSuff8;
  377. {
  378. * Create a socket from an existing descriptor and local and remote
  379. * socket addresses.
  380. * @param apr_sock The new socket that has been set up
  381. * @param os_sock_info The os representation of the socket handle and
  382. * other characteristics of the socket
  383. * @param cont The pool to use
  384. * @remark If you only know the descriptor/handle or if it isn't really
  385. * a true socket, use apr_os_sock_put() instead.
  386. }
  387. function apr_os_sock_make(apr_sock: PPapr_socket_t;
  388. os_sock_info: Papr_os_sock_info_t; cont: Papr_pool_t): apr_status_t;
  389. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  390. external LibAPR name LibNamePrefix + 'apr_os_sock_make' + LibSuff12;
  391. {
  392. * Convert the proc mutex from os specific type to apr type
  393. * @param pmutex The apr proc mutex we are converting to.
  394. * @param ospmutex The os specific proc mutex to convert.
  395. * @param cont The pool to use if it is needed.
  396. }
  397. function apr_os_proc_mutex_put(pmutex: PPapr_proc_mutex_t;
  398. ospmutex: Papr_os_proc_mutex_t; cont: Papr_pool_t): apr_status_t;
  399. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  400. external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_put' + LibSuff12;
  401. {
  402. * Put the imploded time in the APR format.
  403. * @param aprtime the APR time format
  404. * @param ostime the time to convert
  405. * @param cont the pool to use if necessary
  406. }
  407. function apr_os_imp_time_put(aprtime: Papr_time_t;
  408. ostime: PPapr_os_imp_time_t; cont: Papr_pool_t): apr_status_t;
  409. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  410. external LibAPR name LibNamePrefix + 'apr_os_imp_time_put' + LibSuff12;
  411. {
  412. * Put the exploded time in the APR format.
  413. * @param aprtime the APR time format
  414. * @param ostime the time to convert
  415. * @param cont the pool to use if necessary
  416. }
  417. function apr_os_exp_time_put(aprtime: Papr_time_exp_t;
  418. ostime: PPapr_os_exp_time_t; cont: Papr_pool_t): apr_status_t;
  419. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  420. external LibAPR name LibNamePrefix + 'apr_os_exp_time_put' + LibSuff12;
  421. {
  422. * convert the shared memory from os specific type to apr type.
  423. * @param shm The apr shm representation of osshm
  424. * @param osshm The os specific shm identity
  425. * @param cont The pool to use if it is needed.
  426. * @remark On fork()ed architectures, this is typically nothing more than
  427. * the memory block mapped. On non-fork architectures, this is typically
  428. * some internal handle to pass the mapping from process to process.
  429. }
  430. function apr_os_shm_put(shm: PPapr_shm_t; osshm: Papr_os_shm_t;
  431. cont: Papr_pool_t): apr_status_t;
  432. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  433. external LibAPR name LibNamePrefix + 'apr_os_shm_put' + LibSuff8;
  434. {$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
  435. {
  436. * @defgroup apr_os_dso DSO (Dynamic Loading) Portabiliity Routines
  437. }
  438. {
  439. * convert the dso handle from os specific to apr
  440. * @param dso The apr handle we are converting to
  441. * @param thedso the os specific handle to convert
  442. * @param pool the pool to use if it is needed
  443. }
  444. function apr_os_dso_handle_put(dso: PPapr_dso_handle_t;
  445. thedso: apr_os_dso_handle_t; pool: Papr_pool_t): apr_status_t;
  446. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  447. external LibAPR name LibNamePrefix + 'apr_os_dso_handle_put' + LibSuff12;
  448. {
  449. * convert the apr dso handle into an os specific one
  450. * @param aprdso The apr dso handle to convert
  451. * @param dso The os specific dso to return
  452. }
  453. function apr_os_dso_handle_get(dso: Papr_os_dso_handle_t;
  454. aprdso: Papr_dso_handle_t): apr_status_t;
  455. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  456. external LibAPR name LibNamePrefix + 'apr_os_dso_handle_get' + LibSuff8;
  457. {$ifdef APR_HAS_OS_UUID}
  458. {
  459. * Private: apr-util's apr_uuid module when supported by the platform
  460. }
  461. function apr_os_uuid_get(uuid_data: PChar): apr_status_t;
  462. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  463. external LibAPR name LibNamePrefix + 'apr_os_uuid_get' + LibSuff8;
  464. {$endif}
  465. {$endif} { APR_HAS_DSO }
  466. {
  467. * Get the name of the system default characer set.
  468. * @param pool the pool to allocate the name from, if needed
  469. }
  470. function apr_os_default_encoding(pool: Papr_pool_t): PChar;
  471. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  472. external LibAPR name LibNamePrefix + 'apr_os_default_encoding' + LibSuff4;
  473. {
  474. * Get the name of the current locale character set.
  475. * @param pool the pool to allocate the name from, if needed
  476. * @remark Defers to apr_os_default_encoding if the current locale's
  477. * data can't be retreved on this system.
  478. }
  479. function apr_os_locale_encoding(pool: Papr_pool_t): PChar;
  480. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  481. external LibAPR name LibNamePrefix + 'apr_os_locale_encoding' + LibSuff4;