diff options
author | mistachkin <mistachkin@noemail.net> | 2013-06-21 18:32:11 +0000 |
---|---|---|
committer | mistachkin <mistachkin@noemail.net> | 2013-06-21 18:32:11 +0000 |
commit | f5fe3ae9e6ec813a0f015c990ddac7349a933467 (patch) | |
tree | fe707c5648260e826cb61bd85e9f08501ff2ca4c /src/os_unix.c | |
parent | 1654256ac892447558ff0587de76d5b53ac2b6f5 (diff) | |
parent | b01e5b59a2e471d468e1854ef4de4b8f54f3bd6c (diff) | |
download | sqlite-f5fe3ae9e6ec813a0f015c990ddac7349a933467.tar.gz sqlite-f5fe3ae9e6ec813a0f015c990ddac7349a933467.zip |
Merge updates from trunk.
FossilOrigin-Name: fa2a91e6c631864846484d13cffdc51856953cd1
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 30d79f0c5..152bf9a11 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -46,13 +46,6 @@ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ -/* Use posix_fallocate() if it is available -*/ -#if !defined(HAVE_POSIX_FALLOCATE) \ - && (_XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L) -# define HAVE_POSIX_FALLOCATE 1 -#endif - /* ** There are various methods for file locking used for concurrency ** control: @@ -3775,15 +3768,19 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ } case SQLITE_FCNTL_MMAP_SIZE: { i64 newLimit = *(i64*)pArg; + int rc = SQLITE_OK; if( newLimit>sqlite3GlobalConfig.mxMmap ){ newLimit = sqlite3GlobalConfig.mxMmap; } *(i64*)pArg = pFile->mmapSizeMax; - if( newLimit>=0 ){ + if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){ pFile->mmapSizeMax = newLimit; - if( newLimit<pFile->mmapSize ) pFile->mmapSize = newLimit; + if( pFile->mmapSize>0 ){ + unixUnmapfile(pFile); + rc = unixMapfile(pFile, -1); + } } - return SQLITE_OK; + return rc; } #ifdef SQLITE_DEBUG /* The pager calls this method to signal that it has done @@ -5153,7 +5150,7 @@ static int fillInUnixFile( pNew->pVfs = pVfs; pNew->zPath = zFilename; pNew->ctrlFlags = (u8)ctrlFlags; - pNew->mmapSizeMax = sqlite3GlobalConfig.mxMmap; + pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap; if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pNew->ctrlFlags |= UNIXFILE_PSOW; |