sqlite: always use memory for tempfiles.

credits to @bavison for the MAP_POPULATE patch
This commit is contained in:
Stefan Saraev 2014-02-24 19:45:34 +02:00
parent 0f55e23544
commit 59868b5cf1
2 changed files with 23 additions and 1 deletions

View File

@ -61,7 +61,7 @@ PKG_AUTORECONF="yes"
# SQLITE_MAX_MMAP_SIZE can be modified at start-time using the
# sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) call, or at run-time using the
# mmap_size pragma.
CFLAGS="$CFLAGS -DSQLITE_DEFAULT_MMAP_SIZE=268435456"
CFLAGS="$CFLAGS -DSQLITE_TEMP_STORE=3 -DSQLITE_DEFAULT_MMAP_SIZE=268435456"
PKG_CONFIGURE_OPTS_TARGET="--enable-static \

View File

@ -0,0 +1,22 @@
diff --git a/sqlite3.c b/sqlite3.c
index d0057a6..63b80c7 100644
--- a/sqlite3.c
+++ b/sqlite3.c
@@ -28278,7 +28278,7 @@ static void unixRemapfile(
pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
zErr = "mremap";
#else
- pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse);
+ pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED | MAP_POPULATE, h, nReuse);
if( pNew!=MAP_FAILED ){
if( pNew!=pReq ){
osMunmap(pNew, nNew - nReuse);
@@ -28297,7 +28297,7 @@ static void unixRemapfile(
/* If pNew is still NULL, try to create an entirely new mapping. */
if( pNew==0 ){
- pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);
+ pNew = osMmap(0, nNew, flags, MAP_SHARED | MAP_POPULATE, h, 0);
}
if( pNew==MAP_FAILED ){