aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2013-03-21 14:47:47 +0000
committerdan <dan@noemail.net>2013-03-21 14:47:47 +0000
commitc71b45e61944f6964b384614f3da737eff2c2dd6 (patch)
treebcd91e78f23d38775d9f5b8e95942f5b0af66859 /src/os_unix.c
parentd306e1a3a113bd3905c6b661bcb8176b0bb6a844 (diff)
downloadsqlite-c71b45e61944f6964b384614f3da737eff2c2dd6.tar.gz
sqlite-c71b45e61944f6964b384614f3da737eff2c2dd6.zip
Do not use the Linux mremap() call. Use the same strategy for xMremap() as on OSX instead.
FossilOrigin-Name: 5ed8ad780c991d2ca44003ee84350fb5e95ad58e
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 7ab61ed0b..153cf5f43 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4478,16 +4478,12 @@ static int unixMremap(
** it is possible to create a mapping larger than the file on disk and
** extend the file on disk later on.
**
- ** Exploit this on OSX to reduce the number of munmap()/mmap() calls
- ** if the file size is changing. In this case all mappings are rounded
- ** up to the nearest 4MB. And if a new mapping is requested that has the
- ** same rounded size as an old mapping, the old mapping can simply be
- ** reused as is.
- **
- ** It would be possible to do the above on Linux too. However, Linux has
- ** the non-standard mremap() call to resize existing mappings, which can
- ** be used instead. */
-#if defined(__APPLE__)
+ ** Exploit this on Linux and OSX to reduce the number of munmap()/mmap()
+ ** calls required if the file size is changing. In this case all mappings
+ ** are rounded up to the nearest 4MB. And if a new mapping is requested
+ ** that has the same rounded size as an old mapping, the old mapping can
+ ** be reused as is. */
+#if defined(__APPLE__) || defined(__linux__)
nNewRnd = ROUNDUP(nNew, 4096*1024);
nOldRnd = ROUNDUP(nOld, 4096*1024);
#else
@@ -4502,20 +4498,6 @@ static int unixMremap(
}
#endif
- /* On Linux, if there is both an old and new mapping, resize the old
- ** mapping using the non-standard mremap() call. */
-#if defined(_GNU_SOURCE) && defined(__linux__)
- if( nNewRnd && nOldRnd ){
- void *pOld = *ppMap;
- *ppMap = pNew = mremap(pOld, nOldRnd, nNewRnd, MREMAP_MAYMOVE);
- if( pNew==MAP_FAILED ){
- *ppMap = 0;
- return SQLITE_IOERR_MREMAP;
- }
- return SQLITE_OK;
- }
-#endif
-
/* If we get this far, unmap any old mapping. */
if( nOldRnd!=0 ){
void *pOld = *ppMap;