aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-06-26 13:31:50 +0000
committerdrh <drh@noemail.net>2013-06-26 13:31:50 +0000
commitfd64cedc4be4ec9e83fe37190bbc599ae232aaf2 (patch)
treeeb26e9fd9625f522104f3343c3dd77e9296f2fc7 /src/os_unix.c
parent85b303df54a633e71380e3ffc0816ff952399b61 (diff)
parent989a6dbef118464509e7a303717fd0c61bbde1b8 (diff)
downloadsqlite-fd64cedc4be4ec9e83fe37190bbc599ae232aaf2.tar.gz
sqlite-fd64cedc4be4ec9e83fe37190bbc599ae232aaf2.zip
Bring the sessions branch up-to-date with all the latest trunk changes.
FossilOrigin-Name: 086a127236ee99d67513490fb7b5549e8b752c44
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index abc23a452..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