Add an OS method for making copies of file descriptors. This fixes the
crash tests. (CVS 2786) FossilOrigin-Name: 57a674fc71512f11393b8eb595961ec9465ba4e1
This commit is contained in:
@@ -197,6 +197,7 @@ extern struct sqlite3IoVtbl {
|
||||
int (*xLock)(OsFile*, int);
|
||||
int (*xUnlock)(OsFile*, int);
|
||||
int (*xCheckReservedLock)(OsFile *id);
|
||||
void (*xCopyOsFile)(OsFile *pDest, OsFile *pSrc);
|
||||
} sqlite3Io;
|
||||
|
||||
/* The interface for file I/O is above. Other miscellaneous functions
|
||||
|
||||
@@ -1350,6 +1350,12 @@ static char *unixFullPathname(const char *zRelative){
|
||||
return zFull;
|
||||
}
|
||||
|
||||
/*
|
||||
** Make a copy of an OsFile object.
|
||||
*/
|
||||
static void unixCopyOsFile(OsFile *pDest, OsFile *pSrc){
|
||||
*pDest = *pSrc;
|
||||
}
|
||||
|
||||
/*
|
||||
** This is the structure that defines all of the I/O routines.
|
||||
@@ -1375,6 +1381,7 @@ struct sqlite3IoVtbl sqlite3Io = {
|
||||
unixLock,
|
||||
unixUnlock,
|
||||
unixCheckReservedLock,
|
||||
unixCopyOsFile,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -829,6 +829,14 @@ static char *winFullPathname(const char *zRelative){
|
||||
return zFull;
|
||||
}
|
||||
|
||||
/*
|
||||
** Make a copy of an OsFile object.
|
||||
*/
|
||||
static void winCopyOsFile(OsFile *pDest, OsFile *pSrc){
|
||||
*pDest = *pSrc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** This is the structure that defines all of the I/O routines.
|
||||
*/
|
||||
@@ -853,6 +861,7 @@ struct sqlite3IoVtbl sqlite3Io = {
|
||||
winLock,
|
||||
winUnlock,
|
||||
winCheckReservedLock,
|
||||
winCopyOsFile,
|
||||
};
|
||||
|
||||
#endif /* SQLITE_OMIT_DISKIO */
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.218 2005/11/26 00:25:03 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.219 2005/11/26 03:43:23 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@@ -1659,7 +1659,7 @@ int sqlite3pager_open(
|
||||
strcpy(pPager->zJournal, zFullPathname);
|
||||
sqliteFree(zFullPathname);
|
||||
strcpy(&pPager->zJournal[nameLen], "-journal");
|
||||
pPager->fd = fd;
|
||||
sqlite3Io.xCopyOsFile(&pPager->fd,&fd);
|
||||
pPager->journalOpen = 0;
|
||||
pPager->useJournal = useJournal && !memDb;
|
||||
pPager->noReadlock = noReadlock && readOnly;
|
||||
|
||||
@@ -428,6 +428,14 @@ static int crashOpenReadOnly(const char *zFilename, OsFile *id){
|
||||
return origIo.xOpenReadOnly(zFilename, id);
|
||||
}
|
||||
|
||||
/*
|
||||
** Make a copy of an OsFile object
|
||||
*/
|
||||
static void crashCopyOsFile(OsFile *pDest, OsFile *pSrc){
|
||||
*pDest = *pSrc;
|
||||
((OsTestFile*)(pDest->pAux))->pBase = pDest;
|
||||
}
|
||||
|
||||
/*
|
||||
** tclcmd: sqlite_crashparams DELAY CRASHFILE
|
||||
**
|
||||
@@ -464,6 +472,7 @@ static int crashParamsObjCmd(
|
||||
sqlite3Io.xOpenReadWrite = crashOpenReadWrite;
|
||||
sqlite3Io.xOpenExclusive = crashOpenExclusive;
|
||||
sqlite3Io.xOpenReadOnly = crashOpenReadOnly;
|
||||
sqlite3Io.xCopyOsFile = crashCopyOsFile;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user