aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-12-14 18:24:46 +0000
committerdrh <drh@noemail.net>2013-12-14 18:24:46 +0000
commitc8d985e09c2adc83a944889bd6e60e4e86864e3e (patch)
tree462d90e333961e2779b511e3ef74e0505699940a /src/os_unix.c
parent65106c77bb5436a3a4ab16193cc9b98b9c09e228 (diff)
parent4a8ee3dfe2afb5f0478b1bcdf94202cdf98a469d (diff)
downloadsqlite-c8d985e09c2adc83a944889bd6e60e4e86864e3e.tar.gz
sqlite-c8d985e09c2adc83a944889bd6e60e4e86864e3e.zip
Merge in all recent preformance enhancements from trunk.
FossilOrigin-Name: 32477642d79615fb85680bdac812ad9655cf6902
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index ab657dc7b..485b32fd9 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1315,6 +1315,15 @@ static int findInodeInfo(
return SQLITE_OK;
}
+/*
+** Return TRUE if pFile has been renamed or unlinked since it was first opened.
+*/
+static int fileHasMoved(unixFile *pFile){
+ struct stat buf;
+ return pFile->pInode!=0 &&
+ (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino);
+}
+
/*
** Check a unixFile that is a database. Verify the following:
@@ -1349,10 +1358,7 @@ static void verifyDbFile(unixFile *pFile){
pFile->ctrlFlags |= UNIXFILE_WARNED;
return;
}
- if( pFile->pInode!=0
- && ((rc = osStat(pFile->zPath, &buf))!=0
- || buf.st_ino!=pFile->pInode->fileId.ino)
- ){
+ if( fileHasMoved(pFile) ){
sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath);
pFile->ctrlFlags |= UNIXFILE_WARNED;
return;
@@ -3801,6 +3807,10 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
}
return SQLITE_OK;
}
+ case SQLITE_FCNTL_HAS_MOVED: {
+ *(int*)pArg = fileHasMoved(pFile);
+ return SQLITE_OK;
+ }
#if SQLITE_MAX_MMAP_SIZE>0
case SQLITE_FCNTL_MMAP_SIZE: {
i64 newLimit = *(i64*)pArg;