00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
#ifndef APR_MMAP_H
00017
#define APR_MMAP_H
00018
00024
#include "apr.h"
00025
#include "apr_pools.h"
00026
#include "apr_errno.h"
00027
#include "apr_ring.h"
00028
#include "apr_file_io.h"
00029
00030
#ifdef BEOS
00031
#include <kernel/OS.h>
00032
#endif
00033
00034
#ifdef __cplusplus
00035
extern "C" {
00036
#endif
00037
00045 #define APR_MMAP_READ 1
00046
00047 #define APR_MMAP_WRITE 2
00048
00050 typedef struct apr_mmap_t apr_mmap_t;
00051
00061 struct apr_mmap_t {
00063 apr_pool_t *
cntxt;
00064
#ifdef BEOS
00065
00066 area_id area;
00067
#endif
00068
#ifdef WIN32
00069
00070 HANDLE mhandle;
00072
void *mv;
00074 apr_off_t pstart;
00075 apr_size_t psize;
00076 apr_off_t poffset;
00077
#endif
00078
00079 void *
mm;
00081 apr_size_t
size;
00084 int unused;
00087
APR_RING_ENTRY(apr_mmap_t) link;
00088 };
00089
00090 #if APR_HAS_MMAP || defined(DOXYGEN)
00091
00097 #ifdef MMAP_THRESHOLD
00098 # define APR_MMAP_THRESHOLD MMAP_THRESHOLD
00099 #else
00100 # ifdef SUNOS4
00101 # define APR_MMAP_THRESHOLD (8*1024)
00102 # else
00103 # define APR_MMAP_THRESHOLD 1
00104 # endif
00105 #endif
00106
00110 #ifdef MMAP_LIMIT
00111 # define APR_MMAP_LIMIT MMAP_LIMIT
00112 #else
00113 # define APR_MMAP_LIMIT (4*1024*1024)
00114 #endif
00115
00117 #define APR_MMAP_CANDIDATE(filelength) \
00118 ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
00119
00120
00121
00135 APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap,
00136 apr_file_t *file, apr_off_t offset,
00137 apr_size_t size, apr_int32_t flag,
00138 apr_pool_t *cntxt);
00139
00148 APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
00149 apr_mmap_t *old_mmap,
00150 apr_pool_t *p,
00151
int transfer_ownership);
00152
00153 #if defined(DOXYGEN)
00162 APR_DECLARE(apr_status_t) apr_mmap_setaside(apr_mmap_t **new_mmap,
00163 apr_mmap_t *old_mmap,
00164 apr_pool_t *p);
00165 #else
00166 #define apr_mmap_setaside(new_mmap, old_mmap, p) apr_mmap_dup(new_mmap, old_mmap, p, 1)
00167 #endif
00168
00173 APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
00174
00181 APR_DECLARE(apr_status_t) apr_mmap_offset(
void **addr, apr_mmap_t *mm,
00182 apr_off_t offset);
00183
00184 #endif
00185
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191
00192 #endif