-C Refactoring\sthe\smmap\sinterface.\s\sThe\scontrolling\spragma\sis\snow\s"mmap_size"\ninstead\sof\s"mmap_limit".\s\sAlso\schange\sSQLITE_CONFIG_MMAP_LIMIT\sand\nSQLITE_FCNTL_MMAP_LIMIT\sto\sSQLITE_CONFIG_MMAP_SIZE\sand\nSQLITE_FCNTL_MMAP_SIZE,\srespecctively.\s\s\nThe\sdefault\smmap_size\sis\snow\salways\s0,\smeaning\sthat\nmemory\smapped\sI/O\sis\soff\sby\sdefault.\s\sThere\sis\sa\snew\scompile-time\soption\nSQLITE_MAX_MMAP_SIZE\sthat\sdetermines\sa\shard\supper\sbound\son\sthe\smmap_size.\nSetting\sSQLITE_MAX_MMAP_SIZE\sto\szero\sdisables\sthe\smemory-mapped\sI/O\slogic\nand\scauses\sit\sto\sbe\somitted\sfrom\sthe\sbuild.\s\sAn\sextra\sargument\sis\sadded\nto\sSQLITE_CONFIG_MMAP_SIZE\sthat\scan\soptionally\slower\sthe\sSQLITE_MAX_MMAP_SIZE\nat\sstart-time.\sThe\sSQLITE_MAX_MMAP_SIZE\sis\szero\sfor\splatforms\swhere\swe\s\nknow\sthat\sit\sdoes\snot\swork,\smeaning\sthat\sit\scannot\sbe\sturned\son\sby\smistake\non\sthose\splatforms.
-D 2013-04-15T17:03:42.119
+C Expand\sscope\sof\sthe\sSQLITE_MAX_MMAP_SIZE\sdefine\sfor\sthe\sWin32\sVFS.
+D 2013-04-15T20:08:27.655
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3dd3fcb87b70c78d99b2c8a03e44ec86d6ca9ce2
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 0a561eae5965c9371300b0419027f5ae9f847af2
-F src/os_win.c 873bbc5dff8eb9f2bf8d9287d29df082eacb8391
+F src/os_win.c 673b3e3d1fa3040d8d95a7f1f5e0e553aed56cfb
F src/pager.c a55adacb1842b83354198c408e7adde95ecd1189
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
F src/parse.y 5d5e12772845805fdfeb889163516b84fbb9ae95
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 3412424990c93d2978e819e6099811f1cdde316d
-R aa0c6ea54adf9732b395ebf6e1c98243
-U drh
-Z 71eb761a9109889dcfada6d3231b23c2
+P ea1404a10abd7f68e1f8e0708c8a3199d1f79665
+R 4ce5175815a884ac178e2248b6e66ee1
+U mistachkin
+Z 55620fd00464e5f458c15f94b0f9c9d2
winceLock local; /* Locks obtained by this instance of winFile */
winceLock *shared; /* Global shared lock memory for the file */
#endif
+#if SQLITE_MAX_MMAP_SIZE>0
int nFetchOut; /* Number of outstanding xFetch references */
HANDLE hMap; /* Handle for accessing memory mapping */
void *pMapRegion; /* Area memory mapped */
sqlite3_int64 mmapSize; /* Usable size of mapped region */
sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */
sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */
+#endif
};
/*
#endif
}
+#if SQLITE_MAX_MMAP_SIZE>0
/* Forward references to VFS methods */
static int winUnmapfile(winFile*);
+#endif
/*
** Close a file.
OSTRACE(("CLOSE %d\n", pFile->h));
assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
+#if SQLITE_MAX_MMAP_SIZE>0
rc = winUnmapfile(pFile);
if( rc!=SQLITE_OK ) return rc;
+#endif
do{
rc = osCloseHandle(pFile->h);
}
return SQLITE_OK;
}
+#if SQLITE_MAX_MMAP_SIZE>0
case SQLITE_FCNTL_MMAP_SIZE: {
i64 newLimit = *(i64*)pArg;
if( newLimit>sqlite3GlobalConfig.mxMmap ){
if( newLimit>=0 ) pFile->mmapSizeMax = newLimit;
return SQLITE_OK;
}
+#endif
}
return SQLITE_NOTFOUND;
}
/*
** Cleans up the mapped region of the specified file, if any.
*/
+#if SQLITE_MAX_MMAP_SIZE>0
static int winUnmapfile(winFile *pFile){
assert( pFile!=0 );
-#if SQLITE_MAX_MMAP_SIZE>0
if( pFile->pMapRegion ){
if( !osUnmapViewOfFile(pFile->pMapRegion) ){
pFile->lastErrno = osGetLastError();
}
pFile->hMap = NULL;
}
-#endif
return SQLITE_OK;
}
-#if SQLITE_MAX_MMAP_SIZE>0
/*
** Memory map or remap the file opened by file-descriptor pFd (if the file
** is already mapped, the existing mapping is replaced by the new). Or, if
** release the reference by calling unixUnfetch().
*/
static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
+#if SQLITE_MAX_MMAP_SIZE>0
winFile *pFd = (winFile*)fd; /* The underlying database file */
+#endif
*pp = 0;
#if SQLITE_MAX_MMAP_SIZE>0
** may now be invalid and should be unmapped.
*/
static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
+#if SQLITE_MAX_MMAP_SIZE>0
winFile *pFd = (winFile*)fd; /* The underlying database file */
/* If p==0 (unmap the entire file) then there must be no outstanding
}
assert( pFd->nFetchOut>=0 );
+#endif
return SQLITE_OK;
}
}
pFile->lastErrno = NO_ERROR;
pFile->zPath = zName;
+#if SQLITE_MAX_MMAP_SIZE>0
pFile->hMap = NULL;
pFile->pMapRegion = 0;
pFile->mmapSize = 0;
pFile->mmapSizeActual = 0;
pFile->mmapSizeMax = sqlite3GlobalConfig.mxMmap;
+#endif
OpenCounter(+1);
return rc;