Skip to content

Commit

Permalink
sqlite: always use memory for tempfiles.
Browse files Browse the repository at this point in the history
credits to @bavison for the MAP_POPULATE patch
  • Loading branch information
stefansaraev committed Feb 24, 2014
1 parent 0f55e23 commit 59868b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/databases/sqlite/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
22 changes: 22 additions & 0 deletions packages/databases/sqlite/patches/sqlite-01_map_populate.patch
Original file line number Diff line number Diff line change
@@ -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 ){

0 comments on commit 59868b5

Please sign in to comment.