123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- #ifndef APR_MMAP_H
- #define APR_MMAP_H
- #include "apr.h"
- #include "apr_pools.h"
- #include "apr_errno.h"
- #include "apr_ring.h"
- #include "apr_file_io.h"
- #ifdef BEOS
- #include <kernel/OS.h>
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define APR_MMAP_READ 1
- #define APR_MMAP_WRITE 2
- typedef struct apr_mmap_t apr_mmap_t;
- struct apr_mmap_t {
-
- apr_pool_t *cntxt;
- #ifdef BEOS
-
- area_id area;
- #endif
- #ifdef WIN32
-
- HANDLE mhandle;
-
- void *mv;
-
- apr_off_t pstart;
- apr_size_t psize;
- apr_off_t poffset;
- #endif
-
- void *mm;
-
- apr_size_t size;
-
- APR_RING_ENTRY(apr_mmap_t) link;
- };
- #if APR_HAS_MMAP || defined(DOXYGEN)
- #ifdef MMAP_THRESHOLD
- # define APR_MMAP_THRESHOLD MMAP_THRESHOLD
- #else
- # ifdef SUNOS4
- # define APR_MMAP_THRESHOLD (8*1024)
- # else
- # define APR_MMAP_THRESHOLD 1
- # endif
- #endif
- #ifdef MMAP_LIMIT
- # define APR_MMAP_LIMIT MMAP_LIMIT
- #else
- # define APR_MMAP_LIMIT (4*1024*1024)
- #endif
- #define APR_MMAP_CANDIDATE(filelength) \
- ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
- APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap,
- apr_file_t *file, apr_off_t offset,
- apr_size_t size, apr_int32_t flag,
- apr_pool_t *cntxt);
-
- APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
- apr_mmap_t *old_mmap,
- apr_pool_t *p);
- APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
- APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm,
- apr_off_t offset);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|