123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549 |
- #ifndef APR_PORTABLE_H
- #define APR_PORTABLE_H
- #include "apr.h"
- #include "apr_pools.h"
- #include "apr_thread_proc.h"
- #include "apr_file_io.h"
- #include "apr_network_io.h"
- #include "apr_errno.h"
- #include "apr_global_mutex.h"
- #include "apr_proc_mutex.h"
- #include "apr_time.h"
- #include "apr_dso.h"
- #include "apr_shm.h"
- #if APR_HAVE_DIRENT_H
- #include <dirent.h>
- #endif
- #if APR_HAVE_FCNTL_H
- #include <fcntl.h>
- #endif
- #if APR_HAVE_PTHREAD_H
- #include <pthread.h>
- #endif
- #if APR_HAVE_SEMAPHORE_H
- #include <semaphore.h>
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef WIN32
- typedef HANDLE apr_os_file_t;
- typedef HANDLE apr_os_dir_t;
- typedef SOCKET apr_os_sock_t;
- typedef HANDLE apr_os_proc_mutex_t;
- typedef HANDLE apr_os_thread_t;
- typedef HANDLE apr_os_proc_t;
- typedef DWORD apr_os_threadkey_t;
- typedef FILETIME apr_os_imp_time_t;
- typedef SYSTEMTIME apr_os_exp_time_t;
- typedef HANDLE apr_os_dso_handle_t;
- typedef HANDLE apr_os_shm_t;
- #elif defined(OS2)
- typedef HFILE apr_os_file_t;
- typedef HDIR apr_os_dir_t;
- typedef int apr_os_sock_t;
- typedef HMTX apr_os_proc_mutex_t;
- typedef TID apr_os_thread_t;
- typedef PID apr_os_proc_t;
- typedef PULONG apr_os_threadkey_t;
- typedef struct timeval apr_os_imp_time_t;
- typedef struct tm apr_os_exp_time_t;
- typedef HMODULE apr_os_dso_handle_t;
- typedef void* apr_os_shm_t;
- #elif defined(__BEOS__)
- #include <kernel/OS.h>
- #include <kernel/image.h>
- struct apr_os_proc_mutex_t {
- sem_id sem;
- int32 ben;
- };
- typedef int apr_os_file_t;
- typedef DIR apr_os_dir_t;
- typedef int apr_os_sock_t;
- typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
- typedef thread_id apr_os_thread_t;
- typedef thread_id apr_os_proc_t;
- typedef int apr_os_threadkey_t;
- typedef struct timeval apr_os_imp_time_t;
- typedef struct tm apr_os_exp_time_t;
- typedef image_id apr_os_dso_handle_t;
- typedef void* apr_os_shm_t;
- #elif defined(NETWARE)
- typedef int apr_os_file_t;
- typedef DIR apr_os_dir_t;
- typedef int apr_os_sock_t;
- typedef NXMutex_t apr_os_proc_mutex_t;
- typedef NXThreadId_t apr_os_thread_t;
- typedef long apr_os_proc_t;
- typedef NXKey_t apr_os_threadkey_t;
- typedef struct timeval apr_os_imp_time_t;
- typedef struct tm apr_os_exp_time_t;
- typedef void * apr_os_dso_handle_t;
- typedef void* apr_os_shm_t;
- #else
- struct apr_os_proc_mutex_t {
- #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
-
- int crossproc;
- #endif
- #if APR_HAS_PROC_PTHREAD_SERIALIZE
-
- pthread_mutex_t *pthread_interproc;
- #endif
- #if APR_HAS_THREADS
-
- #if APR_USE_PTHREAD_SERIALIZE
-
- pthread_mutex_t *intraproc;
- #endif
- #endif
- #if APR_HAS_POSIXSEM_SERIALIZE
-
- sem_t *psem_interproc;
- #endif
- };
- typedef int apr_os_file_t;
- typedef DIR apr_os_dir_t;
- typedef int apr_os_sock_t;
- typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
- #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
- typedef pthread_t apr_os_thread_t;
- typedef pthread_key_t apr_os_threadkey_t;
- #endif
- typedef pid_t apr_os_proc_t;
- typedef struct timeval apr_os_imp_time_t;
- typedef struct tm apr_os_exp_time_t;
- #if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
- #include <dl.h>
- typedef shl_t apr_os_dso_handle_t;
- #elif defined(DARWIN)
- #include <mach-o/dyld.h>
- typedef NSModule apr_os_dso_handle_t;
- #else
- typedef void * apr_os_dso_handle_t;
- #endif
- typedef void* apr_os_shm_t;
- #endif
- struct apr_os_sock_info_t {
- apr_os_sock_t *os_sock;
- struct sockaddr *local;
- struct sockaddr *remote;
- int family;
- int type;
- int protocol;
- };
- typedef struct apr_os_sock_info_t apr_os_sock_info_t;
- #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
- #define apr_os_global_mutex_t apr_os_proc_mutex_t
- #define apr_os_global_mutex_get apr_os_proc_mutex_get
- #else
-
- struct apr_os_global_mutex_t {
- apr_pool_t *pool;
- apr_proc_mutex_t *proc_mutex;
- #if APR_HAS_THREADS
- apr_thread_mutex_t *thread_mutex;
- #endif
- };
- typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;
- APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
- apr_global_mutex_t *pmutex);
- #endif
- APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
- apr_file_t *file);
-
- APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir,
- apr_dir_t *dir);
- APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
- apr_socket_t *sock);
- APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
- apr_proc_mutex_t *pmutex);
- APR_DECLARE(apr_status_t) apr_os_proc_mutex_get_ex(apr_os_proc_mutex_t *ospmutex,
- apr_proc_mutex_t *pmutex,
- apr_lockmech_e *mech);
- APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime,
- apr_time_exp_t *aprtime);
- APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
- apr_time_t *aprtime);
-
- APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
- apr_shm_t *shm);
- #if APR_HAS_THREADS || defined(DOXYGEN)
- APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
- apr_thread_t *thd);
- APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
- apr_threadkey_t *key);
- APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
- apr_os_thread_t *thethd,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
- apr_os_threadkey_t *thekey,
- apr_pool_t *cont);
- APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
-
- APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
- apr_os_thread_t tid2);
- #endif
- APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
- apr_os_file_t *thefile,
- apr_int32_t flags, apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
- apr_os_file_t *thefile,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
- apr_os_file_t *thefile,
- int register_cleanup,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir,
- apr_os_dir_t *thedir,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock,
- apr_os_sock_t *thesock,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
- apr_os_sock_info_t *os_sock_info,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
- apr_os_proc_mutex_t *ospmutex,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
- apr_os_proc_mutex_t *ospmutex,
- apr_lockmech_e mech,
- int register_cleanup,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime,
- apr_os_imp_time_t **ostime,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
- apr_os_exp_time_t **ostime,
- apr_pool_t *cont);
- APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm,
- apr_os_shm_t *osshm,
- apr_pool_t *cont);
- #if APR_HAS_DSO || defined(DOXYGEN)
- APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
- apr_os_dso_handle_t thedso,
- apr_pool_t *pool);
- APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
- apr_dso_handle_t *aprdso);
- #endif
- #if APR_HAS_OS_UUID
- APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
- #endif
- APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool);
- APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool);
- #ifdef __cplusplus
- }
- #endif
- #endif
|