00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef APR_PORTABLE_H
00022 #define APR_PORTABLE_H
00023
00028 #include "apr.h"
00029 #include "apr_pools.h"
00030 #include "apr_thread_proc.h"
00031 #include "apr_file_io.h"
00032 #include "apr_network_io.h"
00033 #include "apr_errno.h"
00034 #include "apr_global_mutex.h"
00035 #include "apr_proc_mutex.h"
00036 #include "apr_time.h"
00037 #include "apr_dso.h"
00038 #include "apr_shm.h"
00039
00040 #if APR_HAVE_DIRENT_H
00041 #include <dirent.h>
00042 #endif
00043 #if APR_HAVE_FCNTL_H
00044 #include <fcntl.h>
00045 #endif
00046 #if APR_HAVE_PTHREAD_H
00047 #include <pthread.h>
00048 #endif
00049
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053
00060 #ifdef WIN32
00061
00062 typedef HANDLE apr_os_file_t;
00063 typedef HANDLE apr_os_dir_t;
00064 typedef SOCKET apr_os_sock_t;
00065 typedef HANDLE apr_os_proc_mutex_t;
00066 typedef HANDLE apr_os_thread_t;
00067 typedef HANDLE apr_os_proc_t;
00068 typedef DWORD apr_os_threadkey_t;
00069 typedef FILETIME apr_os_imp_time_t;
00070 typedef SYSTEMTIME apr_os_exp_time_t;
00071 typedef HANDLE apr_os_dso_handle_t;
00072 typedef HANDLE apr_os_shm_t;
00073
00074 #elif defined(OS2)
00075 typedef HFILE apr_os_file_t;
00076 typedef HDIR apr_os_dir_t;
00077 typedef int apr_os_sock_t;
00078 typedef HMTX apr_os_proc_mutex_t;
00079 typedef TID apr_os_thread_t;
00080 typedef PID apr_os_proc_t;
00081 typedef PULONG apr_os_threadkey_t;
00082 typedef struct timeval apr_os_imp_time_t;
00083 typedef struct tm apr_os_exp_time_t;
00084 typedef HMODULE apr_os_dso_handle_t;
00085 typedef void* apr_os_shm_t;
00086
00087 #elif defined(__BEOS__)
00088 #include <kernel/OS.h>
00089 #include <kernel/image.h>
00090
00091 struct apr_os_proc_mutex_t {
00092 sem_id sem;
00093 int32 ben;
00094 };
00095
00096 typedef int apr_os_file_t;
00097 typedef DIR apr_os_dir_t;
00098 typedef int apr_os_sock_t;
00099 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
00100 typedef thread_id apr_os_thread_t;
00101 typedef thread_id apr_os_proc_t;
00102 typedef int apr_os_threadkey_t;
00103 typedef struct timeval apr_os_imp_time_t;
00104 typedef struct tm apr_os_exp_time_t;
00105 typedef image_id apr_os_dso_handle_t;
00106 typedef void* apr_os_shm_t;
00107
00108 #elif defined(NETWARE)
00109 typedef int apr_os_file_t;
00110 typedef DIR apr_os_dir_t;
00111 typedef int apr_os_sock_t;
00112 typedef NXMutex_t apr_os_proc_mutex_t;
00113 typedef NXThreadId_t apr_os_thread_t;
00114 typedef long apr_os_proc_t;
00115 typedef NXKey_t apr_os_threadkey_t;
00116 typedef struct timeval apr_os_imp_time_t;
00117 typedef struct tm apr_os_exp_time_t;
00118 typedef void * apr_os_dso_handle_t;
00119 typedef void* apr_os_shm_t;
00120
00121 #else
00122
00123
00124
00125
00127 struct apr_os_proc_mutex_t {
00128 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
00129 int crossproc;
00130 #endif
00131 #if APR_HAS_PROC_PTHREAD_SERIALIZE
00132 pthread_mutex_t *pthread_interproc;
00133 #endif
00134 #if APR_HAS_THREADS
00135
00136 #if APR_USE_PTHREAD_SERIALIZE
00137 pthread_mutex_t *intraproc;
00138 #endif
00139 #endif
00140 };
00141
00142 typedef int apr_os_file_t;
00143 typedef DIR apr_os_dir_t;
00144 typedef int apr_os_sock_t;
00145 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
00148 #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
00149 typedef pthread_t apr_os_thread_t;
00150 typedef pthread_key_t apr_os_threadkey_t;
00152 #endif
00153 typedef pid_t apr_os_proc_t;
00154 typedef struct timeval apr_os_imp_time_t;
00155 typedef struct tm apr_os_exp_time_t;
00159 #if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
00160 #include <dl.h>
00161 typedef shl_t apr_os_dso_handle_t;
00162 #elif defined(DARWIN)
00163 #include <mach-o/dyld.h>
00164 typedef NSModule apr_os_dso_handle_t;
00165 #else
00166 typedef void * apr_os_dso_handle_t;
00167 #endif
00168 typedef void* apr_os_shm_t;
00170 #endif
00171
00180 struct apr_os_sock_info_t {
00181 apr_os_sock_t *os_sock;
00182 struct sockaddr *local;
00183 struct sockaddr *remote;
00184 int family;
00185 int type;
00186 #ifdef APR_ENABLE_FOR_1_0
00187 int protocol;
00188 #endif
00189 };
00190
00191 typedef struct apr_os_sock_info_t apr_os_sock_info_t;
00192
00193 #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
00194
00195 #define apr_os_global_mutex_t apr_os_proc_mutex_t
00196
00197 #define apr_os_global_mutex_get apr_os_proc_mutex_get
00198 #else
00199
00202 struct apr_os_global_mutex_t {
00203 apr_pool_t *pool;
00204 apr_proc_mutex_t *proc_mutex;
00205 #if APR_HAS_THREADS
00206 apr_thread_mutex_t *thread_mutex;
00207 #endif
00208 };
00209 typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;
00210
00211 APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
00212 apr_global_mutex_t *pmutex);
00213 #endif
00214
00215
00223 APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
00224 apr_file_t *file);
00225
00231 APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir,
00232 apr_dir_t *dir);
00233
00239 APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
00240 apr_socket_t *sock);
00241
00247 APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
00248 apr_proc_mutex_t *pmutex);
00249
00255 APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime,
00256 apr_time_exp_t *aprtime);
00257
00263 APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
00264 apr_time_t *aprtime);
00265
00271 APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
00272 apr_shm_t *shm);
00273
00274 #if APR_HAS_THREADS || defined(DOXYGEN)
00275
00284 APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
00285 apr_thread_t *thd);
00286
00292 APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
00293 apr_threadkey_t *key);
00294
00301 APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
00302 apr_os_thread_t *thethd,
00303 apr_pool_t *cont);
00304
00311 APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
00312 apr_os_threadkey_t *thekey,
00313 apr_pool_t *cont);
00317 APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
00318
00324 APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
00325 apr_os_thread_t tid2);
00326
00328 #endif
00329
00339 APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
00340 apr_os_file_t *thefile,
00341 apr_int32_t flags, apr_pool_t *cont);
00342
00351 APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
00352 apr_os_file_t *thefile,
00353 apr_pool_t *cont);
00354
00365 APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
00366 apr_os_file_t *thefile,
00367 int register_cleanup,
00368 apr_pool_t *cont);
00369
00376 APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir,
00377 apr_os_dir_t *thedir,
00378 apr_pool_t *cont);
00379
00388 APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock,
00389 apr_os_sock_t *thesock,
00390 apr_pool_t *cont);
00391
00402 APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
00403 apr_os_sock_info_t *os_sock_info,
00404 apr_pool_t *cont);
00405
00412 APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
00413 apr_os_proc_mutex_t *ospmutex,
00414 apr_pool_t *cont);
00415
00422 APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime,
00423 apr_os_imp_time_t **ostime,
00424 apr_pool_t *cont);
00425
00432 APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
00433 apr_os_exp_time_t **ostime,
00434 apr_pool_t *cont);
00435
00445 APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm,
00446 apr_os_shm_t *osshm,
00447 apr_pool_t *cont);
00448
00449
00450 #if APR_HAS_DSO || defined(DOXYGEN)
00451
00461 APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
00462 apr_os_dso_handle_t thedso,
00463 apr_pool_t *pool);
00464
00470 APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
00471 apr_dso_handle_t *aprdso);
00472
00473 #if APR_HAS_OS_UUID
00474
00477 APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
00478 #endif
00479
00481 #endif
00482
00483
00488 APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool);
00489
00490
00497 APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool);
00498
00501 #ifdef __cplusplus
00502 }
00503 #endif
00504
00505 #endif