00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef APR_MMAP_H
00018 #define APR_MMAP_H
00019
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 #include "apr_errno.h"
00028 #include "apr_ring.h"
00029 #include "apr_file_io.h"
00030
00031 #ifdef BEOS
00032 #include <kernel/OS.h>
00033 #endif
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00046 #define APR_MMAP_READ 1
00047
00048 #define APR_MMAP_WRITE 2
00049
00051 typedef struct apr_mmap_t apr_mmap_t;
00052
00062 struct apr_mmap_t {
00064 apr_pool_t *cntxt;
00065 #ifdef BEOS
00066
00067 area_id area;
00068 #endif
00069 #ifdef WIN32
00070
00071 HANDLE mhandle;
00073 void *mv;
00075 apr_off_t pstart;
00076 apr_size_t psize;
00077 apr_off_t poffset;
00078 #endif
00079
00080 void *mm;
00082 apr_size_t size;
00085 APR_RING_ENTRY(apr_mmap_t) link;
00086 };
00087
00088 #if APR_HAS_MMAP || defined(DOXYGEN)
00089
00095 #ifdef MMAP_THRESHOLD
00096 # define APR_MMAP_THRESHOLD MMAP_THRESHOLD
00097 #else
00098 # ifdef SUNOS4
00099 # define APR_MMAP_THRESHOLD (8*1024)
00100 # else
00101 # define APR_MMAP_THRESHOLD 1
00102 # endif
00103 #endif
00104
00108 #ifdef MMAP_LIMIT
00109 # define APR_MMAP_LIMIT MMAP_LIMIT
00110 #else
00111 # define APR_MMAP_LIMIT (4*1024*1024)
00112 #endif
00113
00115 #define APR_MMAP_CANDIDATE(filelength) \
00116 ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
00117
00118
00119
00133 APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap,
00134 apr_file_t *file, apr_off_t offset,
00135 apr_size_t size, apr_int32_t flag,
00136 apr_pool_t *cntxt);
00137
00144 APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
00145 apr_mmap_t *old_mmap,
00146 apr_pool_t *p);
00147
00152 APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
00153
00160 APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm,
00161 apr_off_t offset);
00162
00163 #endif
00164
00167 #ifdef __cplusplus
00168 }
00169 #endif
00170
00171 #endif