00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #ifndef APR_PORTABLE_H
00060 #define APR_PORTABLE_H
00061
00066 #include "apr.h"
00067 #include "apr_pools.h"
00068 #include "apr_thread_proc.h"
00069 #include "apr_file_io.h"
00070 #include "apr_network_io.h"
00071 #include "apr_errno.h"
00072 #include "apr_global_mutex.h"
00073 #include "apr_proc_mutex.h"
00074 #include "apr_time.h"
00075 #include "apr_dso.h"
00076 #include "apr_shm.h"
00077
00078 #if APR_HAVE_DIRENT_H
00079 #include <dirent.h>
00080 #endif
00081 #if APR_HAVE_FCNTL_H
00082 #include <fcntl.h>
00083 #endif
00084 #if APR_HAVE_PTHREAD_H
00085 #include <pthread.h>
00086 #endif
00087
00088 #ifdef __cplusplus
00089 extern "C" {
00090 #endif
00091
00098 #ifdef WIN32
00099
00100 typedef HANDLE apr_os_file_t;
00101 typedef HANDLE apr_os_dir_t;
00102 typedef SOCKET apr_os_sock_t;
00103 typedef HANDLE apr_os_proc_mutex_t;
00104 typedef HANDLE apr_os_thread_t;
00105 typedef HANDLE apr_os_proc_t;
00106 typedef DWORD apr_os_threadkey_t;
00107 typedef FILETIME apr_os_imp_time_t;
00108 typedef SYSTEMTIME apr_os_exp_time_t;
00109 typedef HANDLE apr_os_dso_handle_t;
00110 typedef HANDLE apr_os_shm_t;
00111
00112 #elif defined(OS2)
00113 typedef HFILE apr_os_file_t;
00114 typedef HDIR apr_os_dir_t;
00115 typedef int apr_os_sock_t;
00116 typedef HMTX apr_os_proc_mutex_t;
00117 typedef TID apr_os_thread_t;
00118 typedef PID apr_os_proc_t;
00119 typedef PULONG apr_os_threadkey_t;
00120 typedef struct timeval apr_os_imp_time_t;
00121 typedef struct tm apr_os_exp_time_t;
00122 typedef HMODULE apr_os_dso_handle_t;
00123 typedef void* apr_os_shm_t;
00124
00125 #elif defined(__BEOS__)
00126 #include <kernel/OS.h>
00127 #include <kernel/image.h>
00128
00129 struct apr_os_proc_mutex_t {
00130 sem_id sem;
00131 int32 ben;
00132 };
00133
00134 typedef int apr_os_file_t;
00135 typedef DIR apr_os_dir_t;
00136 typedef int apr_os_sock_t;
00137 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
00138 typedef thread_id apr_os_thread_t;
00139 typedef thread_id apr_os_proc_t;
00140 typedef int apr_os_threadkey_t;
00141 typedef struct timeval apr_os_imp_time_t;
00142 typedef struct tm apr_os_exp_time_t;
00143 typedef image_id apr_os_dso_handle_t;
00144 typedef void* apr_os_shm_t;
00145
00146 #elif defined(NETWARE)
00147 typedef int apr_os_file_t;
00148 typedef DIR apr_os_dir_t;
00149 typedef int apr_os_sock_t;
00150 typedef NXMutex_t apr_os_proc_mutex_t;
00151 typedef NXThreadId_t apr_os_thread_t;
00152 typedef long apr_os_proc_t;
00153 typedef NXKey_t apr_os_threadkey_t;
00154 typedef struct timeval apr_os_imp_time_t;
00155 typedef struct tm apr_os_exp_time_t;
00156 typedef void * apr_os_dso_handle_t;
00157 typedef void* apr_os_shm_t;
00158
00159 #else
00160
00161
00162
00163
00165 struct apr_os_proc_mutex_t {
00166 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
00167 int crossproc;
00168 #endif
00169 #if APR_HAS_PROC_PTHREAD_SERIALIZE
00170 pthread_mutex_t *pthread_interproc;
00171 #endif
00172 #if APR_HAS_THREADS
00173
00174 #if APR_USE_PTHREAD_SERIALIZE
00175 pthread_mutex_t *intraproc;
00176 #endif
00177 #endif
00178 };
00179
00180 typedef int apr_os_file_t;
00181 typedef DIR apr_os_dir_t;
00182 typedef int apr_os_sock_t;
00183 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
00186 #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
00187 typedef pthread_t apr_os_thread_t;
00188 typedef pthread_key_t apr_os_threadkey_t;
00190 #endif
00191 typedef pid_t apr_os_proc_t;
00192 typedef struct timeval apr_os_imp_time_t;
00193 typedef struct tm apr_os_exp_time_t;
00197 #if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
00198 #include <dl.h>
00199 typedef shl_t apr_os_dso_handle_t;
00200 #elif defined(DARWIN)
00201 #include <mach-o/dyld.h>
00202 typedef NSModule apr_os_dso_handle_t;
00203 #else
00204 typedef void * apr_os_dso_handle_t;
00205 #endif
00206 typedef void* apr_os_shm_t;
00208 #endif
00209
00218 struct apr_os_sock_info_t {
00219 apr_os_sock_t *os_sock;
00220 struct sockaddr *local;
00221 struct sockaddr *remote;
00222 int family;
00223 int type;
00224 #ifdef APR_ENABLE_FOR_1_0
00225 int protocol;
00226 #endif
00227 };
00228
00229 typedef struct apr_os_sock_info_t apr_os_sock_info_t;
00230
00231 #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
00232
00233 #define apr_os_global_mutex_t apr_os_proc_mutex_t
00234
00235 #define apr_os_global_mutex_get apr_os_proc_mutex_get
00236 #else
00237
00240 struct apr_os_global_mutex_t {
00241 apr_pool_t *pool;
00242 apr_proc_mutex_t *proc_mutex;
00243 #if APR_HAS_THREADS
00244 apr_thread_mutex_t *thread_mutex;
00245 #endif
00246 };
00247 typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;
00248
00249 APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
00250 apr_global_mutex_t *pmutex);
00251 #endif
00252
00253
00261 APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
00262 apr_file_t *file);
00263
00269 APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir,
00270 apr_dir_t *dir);
00271
00277 APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
00278 apr_socket_t *sock);
00279
00285 APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
00286 apr_proc_mutex_t *pmutex);
00287
00293 APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime,
00294 apr_time_exp_t *aprtime);
00295
00301 APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
00302 apr_time_t *aprtime);
00303
00309 APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
00310 apr_shm_t *shm);
00311
00312 #if APR_HAS_THREADS || defined(DOXYGEN)
00322 APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
00323 apr_thread_t *thd);
00324
00330 APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
00331 apr_threadkey_t *key);
00332
00339 APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
00340 apr_os_thread_t *thethd,
00341 apr_pool_t *cont);
00342
00349 APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
00350 apr_os_threadkey_t *thekey,
00351 apr_pool_t *cont);
00355 APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
00356
00362 APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
00363 apr_os_thread_t tid2);
00364
00366 #endif
00367
00377 APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
00378 apr_os_file_t *thefile,
00379 apr_int32_t flags, apr_pool_t *cont);
00380
00389 APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
00390 apr_os_file_t *thefile,
00391 apr_pool_t *cont);
00392
00399 APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir,
00400 apr_os_dir_t *thedir,
00401 apr_pool_t *cont);
00402
00411 APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock,
00412 apr_os_sock_t *thesock,
00413 apr_pool_t *cont);
00414
00425 APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
00426 apr_os_sock_info_t *os_sock_info,
00427 apr_pool_t *cont);
00428
00435 APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
00436 apr_os_proc_mutex_t *ospmutex,
00437 apr_pool_t *cont);
00438
00445 APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime,
00446 apr_os_imp_time_t **ostime,
00447 apr_pool_t *cont);
00448
00455 APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
00456 apr_os_exp_time_t **ostime,
00457 apr_pool_t *cont);
00458
00468 APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm,
00469 apr_os_shm_t *osshm,
00470 apr_pool_t *cont);
00471
00472
00473 #if APR_HAS_DSO || defined(DOXYGEN)
00484 APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
00485 apr_os_dso_handle_t thedso,
00486 apr_pool_t *pool);
00487
00493 APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
00494 apr_dso_handle_t *aprdso);
00495
00496 #if APR_HAS_OS_UUID
00500 APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
00501 #endif
00502
00504 #endif
00505
00506
00511 APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool);
00512
00513
00520 APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool);
00521
00524 #ifdef __cplusplus
00525 }
00526 #endif
00527
00528 #endif