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