aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-04-09 16:19:20 +0000
committerdrh <drh@noemail.net>2013-04-09 16:19:20 +0000
commit6e0b6d52da6a6245c97a40997a95f8cb14fed502 (patch)
treeeee77ca0e0ec6739a674644f9b51e0c5c1f3c476 /src/os_unix.c
parent188d488409c9d931bb8b59eb86956ec6130017e7 (diff)
downloadsqlite-6e0b6d52da6a6245c97a40997a95f8cb14fed502.tar.gz
sqlite-6e0b6d52da6a6245c97a40997a95f8cb14fed502.zip
Add extra #ifndef statements in os_unix.c and os_win.c to make sure the
memory mapped I/O really is disabled when SQLITE_DISABLE_MMAP is set. FossilOrigin-Name: c1e2523c9051782569291fff998140f7e0b70b6d
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 1d4c8ad34..a65f894eb 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3117,6 +3117,7 @@ static int unixRead(
);
#endif
+#if !defined(SQLITE_DISABLE_MMAP)
/* Deal with as much of this read request as possible by transfering
** data from the memory mapping using memcpy(). */
if( offset<pFile->mmapSize ){
@@ -3131,6 +3132,7 @@ static int unixRead(
offset += nCopy;
}
}
+#endif
got = seekAndRead(pFile, offset, pBuf, amt);
if( got==amt ){
@@ -3236,6 +3238,7 @@ static int unixWrite(
}
#endif
+#if !defined(SQLITE_DISABLE_MMAP)
/* Deal with as much of this write request as possible by transfering
** data from the memory mapping using memcpy(). */
if( offset<pFile->mmapSize ){
@@ -3250,6 +3253,7 @@ static int unixWrite(
offset += nCopy;
}
}
+#endif
while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){
amt -= wrote;
@@ -4525,12 +4529,14 @@ static int unixShmUnmap(
*/
static void unixUnmapfile(unixFile *pFd){
assert( pFd->nFetchOut==0 );
+#ifndef SQLITE_DISABLE_MMAP
if( pFd->pMapRegion ){
osMunmap(pFd->pMapRegion, pFd->mmapOrigsize);
pFd->pMapRegion = 0;
pFd->mmapSize = 0;
pFd->mmapOrigsize = 0;
}
+#endif
}
/*
@@ -4546,6 +4552,7 @@ static int unixGetPagesize(void){
#endif
}
+#ifndef SQLITE_DISABLE_MMAP
/*
** Attempt to set the size of the memory mapping maintained by file
** descriptor pFd to nNew bytes. Any existing mapping is discarded.
@@ -4630,6 +4637,7 @@ static void unixRemapfile(
pFd->pMapRegion = (void *)pNew;
pFd->mmapSize = pFd->mmapOrigsize = nNew;
}
+#endif
/*
** Memory map or remap the file opened by file-descriptor pFd (if the file
@@ -4651,6 +4659,7 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
i64 nMap = nByte;
int rc;
+#ifndef SQLITE_DISABLE_MMAP
assert( nMap>=0 || pFd->nFetchOut==0 );
if( pFd->nFetchOut>0 ) return SQLITE_OK;
@@ -4673,6 +4682,7 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
unixUnmapfile(pFd);
}
}
+#endif
return SQLITE_OK;
}
@@ -4693,6 +4703,7 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
unixFile *pFd = (unixFile *)fd; /* The underlying database file */
*pp = 0;
+#ifndef SQLITE_DISABLE_MMAP
if( pFd->mmapLimit>0 ){
if( pFd->pMapRegion==0 ){
int rc = unixMapfile(pFd, -1);
@@ -4703,6 +4714,7 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
pFd->nFetchOut++;
}
}
+#endif
return SQLITE_OK;
}