Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_mmap.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation 00002 * 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * http://www.apache.org/licenses/LICENSE-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 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" /* for apr_file_t */ 00029 00030 #ifdef BEOS 00031 #include <kernel/OS.h> 00032 #endif 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif /* __cplusplus */ 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 /* SUNOS4 */ 00105 #endif /* MMAP_THRESHOLD */ 00106 00110 #ifdef MMAP_LIMIT 00111 # define APR_MMAP_LIMIT MMAP_LIMIT 00112 #else 00113 # define APR_MMAP_LIMIT (4*1024*1024) 00114 #endif /* MMAP_LIMIT */ 00115 00117 #define APR_MMAP_CANDIDATE(filelength) \ 00118 ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT)) 00119 00120 /* Function definitions */ 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 /* DOXYGEN */ 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 /* APR_HAS_MMAP */ 00185 00188 #ifdef __cplusplus 00189 } 00190 #endif 00191 00192 #endif /* ! APR_MMAP_H */

Generated on Tue Aug 10 17:42:34 2004 for Apache Portable Runtime by doxygen 1.3.7