From: mistachkin Date: Mon, 15 Apr 2013 20:08:27 +0000 (+0000) Subject: Expand scope of the SQLITE_MAX_MMAP_SIZE define for the Win32 VFS. X-Git-Tag: version-3.7.17~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5824e05315453704c332f5cf64665932a059260f;p=thirdparty%2Fsqlite.git Expand scope of the SQLITE_MAX_MMAP_SIZE define for the Win32 VFS. FossilOrigin-Name: f4b8faab45e217f227bd7ce65d4741754731b8cd --- diff --git a/manifest b/manifest index 215a7b5881..a560dd55b0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -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 @@ -167,7 +167,7 @@ F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be 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 @@ -1051,7 +1051,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 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 diff --git a/manifest.uuid b/manifest.uuid index 65cc51dd9d..b2fbd3d393 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ea1404a10abd7f68e1f8e0708c8a3199d1f79665 \ No newline at end of file +f4b8faab45e217f227bd7ce65d4741754731b8cd \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index e56ccb50c6..12eefed8be 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -150,12 +150,14 @@ struct winFile { 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 }; /* @@ -2068,8 +2070,10 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){ #endif } +#if SQLITE_MAX_MMAP_SIZE>0 /* Forward references to VFS methods */ static int winUnmapfile(winFile*); +#endif /* ** Close a file. @@ -2093,8 +2097,10 @@ static int winClose(sqlite3_file *id){ 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); @@ -2842,6 +2848,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ } return SQLITE_OK; } +#if SQLITE_MAX_MMAP_SIZE>0 case SQLITE_FCNTL_MMAP_SIZE: { i64 newLimit = *(i64*)pArg; if( newLimit>sqlite3GlobalConfig.mxMmap ){ @@ -2851,6 +2858,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ if( newLimit>=0 ) pFile->mmapSizeMax = newLimit; return SQLITE_OK; } +#endif } return SQLITE_NOTFOUND; } @@ -3524,9 +3532,9 @@ shmpage_out: /* ** 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(); @@ -3545,11 +3553,9 @@ static int winUnmapfile(winFile *pFile){ } 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 @@ -3652,7 +3658,9 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ ** 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 @@ -3681,6 +3689,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ ** 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 @@ -3702,6 +3711,7 @@ static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){ } assert( pFd->nFetchOut>=0 ); +#endif return SQLITE_OK; } @@ -4129,11 +4139,13 @@ static int winOpen( } 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;