Updates to the locking-style code in os_unix.c. Not yet working. (CVS 4834)
FossilOrigin-Name: 6ebce3b798c60050fb3c583d805570bb06837108
This commit is contained in:
parent
98dc4b1aba
commit
218c508433
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Clean\sup\srecent\sautoconf-related\sadditions,\sadd\sconfig.h\sto\sthe\samalgamation\s(CVS\s4833)
|
C Updates\sto\sthe\slocking-style\scode\sin\sos_unix.c.\s\sNot\syet\sworking.\s(CVS\s4834)
|
||||||
D 2008-03-06T16:28:58
|
D 2008-03-07T00:27:10
|
||||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||||
F Makefile.in 724ca16b1b62dd123344b2945b906f9e6d922ff8
|
F Makefile.in 724ca16b1b62dd123344b2945b906f9e6d922ff8
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@ -125,7 +125,7 @@ F src/os_os2.c 10b23539e0050bdfc9f136242086a5c18c70c6f8
|
|||||||
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
||||||
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
||||||
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
||||||
F src/os_unix.c e4daef7628f690fa2b188af3632fb18f96525946
|
F src/os_unix.c b21695b8cc529f9aad7507bdc0d31cfa72623159
|
||||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||||
F src/os_win.c aa3f4bbee3b8c182d25a33fbc319f486857c12c1
|
F src/os_win.c aa3f4bbee3b8c182d25a33fbc319f486857c12c1
|
||||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||||
@ -623,7 +623,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||||
P e2a9f5f1054f077e4773dd3d2c8f2ce5be118a01
|
P 8044623062e9aa43593c46e3e5d5bc7361ea7418
|
||||||
R 40dd63e8c23d267ba43a975ab562cefb
|
R 0ade21cdb2beced327069a3136a9d80f
|
||||||
U mlcreech
|
U drh
|
||||||
Z 77eff1d0b0188f0cd2e341dd1c104736
|
Z 33a6ec815f80c4e0995bb3a35a490baa
|
||||||
|
@ -1 +1 @@
|
|||||||
8044623062e9aa43593c46e3e5d5bc7361ea7418
|
6ebce3b798c60050fb3c583d805570bb06837108
|
@ -1745,10 +1745,10 @@ static int afpUnixUnlock(sqlite3_file *id, int locktype) {
|
|||||||
** Close a file & cleanup AFP specific locking context
|
** Close a file & cleanup AFP specific locking context
|
||||||
*/
|
*/
|
||||||
static int afpUnixClose(sqlite3_file *id) {
|
static int afpUnixClose(sqlite3_file *id) {
|
||||||
unixFile *pFile = (unixFile*)pId;
|
unixFile *pFile = (unixFile*)id;
|
||||||
|
|
||||||
if( !pFile ) return SQLITE_OK;
|
if( !pFile ) return SQLITE_OK;
|
||||||
afpUnixUnlock(*pId, NO_LOCK);
|
afpUnixUnlock(id, NO_LOCK);
|
||||||
/* free the AFP locking structure */
|
/* free the AFP locking structure */
|
||||||
if (pFile->lockingContext != NULL) {
|
if (pFile->lockingContext != NULL) {
|
||||||
if (((afpLockingContext *)pFile->lockingContext)->filePath != NULL)
|
if (((afpLockingContext *)pFile->lockingContext)->filePath != NULL)
|
||||||
@ -1758,9 +1758,12 @@ static int afpUnixClose(sqlite3_file *id) {
|
|||||||
|
|
||||||
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
||||||
pFile->dirfd = -1;
|
pFile->dirfd = -1;
|
||||||
|
enterMutex();
|
||||||
close(pFile->h);
|
close(pFile->h);
|
||||||
|
leaveMutex();
|
||||||
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
|
memset(pFile, 0, sizeof(unixFile));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1840,20 +1843,21 @@ static int flockUnixUnlock(sqlite3_file *id, int locktype) {
|
|||||||
/*
|
/*
|
||||||
** Close a file.
|
** Close a file.
|
||||||
*/
|
*/
|
||||||
static int flockUnixClose(sqlite3_file *pId) {
|
static int flockUnixClose(sqlite3_file *id) {
|
||||||
unixFile *pFile = (unixFile*)*pId;
|
unixFile *pFile = (unixFile*)id;
|
||||||
|
|
||||||
if( !pFile ) return SQLITE_OK;
|
if( !pFile ) return SQLITE_OK;
|
||||||
flockUnixUnlock(*pId, NO_LOCK);
|
flockUnixUnlock(id, NO_LOCK);
|
||||||
|
|
||||||
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
||||||
pFile->dirfd = -1;
|
pFile->dirfd = -1;
|
||||||
enterMutex();
|
|
||||||
|
|
||||||
|
enterMutex();
|
||||||
close(pFile->h);
|
close(pFile->h);
|
||||||
leaveMutex();
|
leaveMutex();
|
||||||
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
|
memset(pFile, 0, sizeof(unixFile));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1952,7 +1956,7 @@ static int dotlockUnixClose(sqlite3_file *id) {
|
|||||||
unixFile *pFile = (unixFile*)id;
|
unixFile *pFile = (unixFile*)id;
|
||||||
|
|
||||||
if( !pFile ) return SQLITE_OK;
|
if( !pFile ) return SQLITE_OK;
|
||||||
dotlockUnixUnlock(*pId, NO_LOCK);
|
dotlockUnixUnlock(id, NO_LOCK);
|
||||||
/* free the dotlock locking structure */
|
/* free the dotlock locking structure */
|
||||||
if (pFile->lockingContext != NULL) {
|
if (pFile->lockingContext != NULL) {
|
||||||
if (((dotlockLockingContext *)pFile->lockingContext)->lockPath != NULL)
|
if (((dotlockLockingContext *)pFile->lockingContext)->lockPath != NULL)
|
||||||
@ -1964,12 +1968,11 @@ static int dotlockUnixClose(sqlite3_file *id) {
|
|||||||
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
||||||
pFile->dirfd = -1;
|
pFile->dirfd = -1;
|
||||||
enterMutex();
|
enterMutex();
|
||||||
|
|
||||||
close(pFile->h);
|
close(pFile->h);
|
||||||
|
|
||||||
leaveMutex();
|
leaveMutex();
|
||||||
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
|
memset(pFile, 0, sizeof(unixFile));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2003,12 +2006,11 @@ static int nolockUnixClose(sqlite3_file *id) {
|
|||||||
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
if( pFile->dirfd>=0 ) close(pFile->dirfd);
|
||||||
pFile->dirfd = -1;
|
pFile->dirfd = -1;
|
||||||
enterMutex();
|
enterMutex();
|
||||||
|
|
||||||
close(pFile->h);
|
close(pFile->h);
|
||||||
|
|
||||||
leaveMutex();
|
leaveMutex();
|
||||||
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
OSTRACE2("CLOSE %-3d\n", pFile->h);
|
||||||
OpenCounter(-1);
|
OpenCounter(-1);
|
||||||
|
memset(pFile, 0, sizeof(unixFile));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2076,7 +2078,7 @@ static const sqlite3_io_methods sqlite3UnixIoMethod = {
|
|||||||
*/
|
*/
|
||||||
static const sqlite3_io_methods sqlite3AFPLockingUnixIoMethod = {
|
static const sqlite3_io_methods sqlite3AFPLockingUnixIoMethod = {
|
||||||
1, /* iVersion */
|
1, /* iVersion */
|
||||||
unixClose,
|
afpUnixClose,
|
||||||
unixRead,
|
unixRead,
|
||||||
unixWrite,
|
unixWrite,
|
||||||
unixTruncate,
|
unixTruncate,
|
||||||
@ -2167,22 +2169,26 @@ static const sqlite3_io_methods sqlite3NolockLockingUnixIoMethod = {
|
|||||||
static int fillInUnixFile(
|
static int fillInUnixFile(
|
||||||
int h, /* Open file descriptor of file being opened */
|
int h, /* Open file descriptor of file being opened */
|
||||||
int dirfd, /* Directory file descriptor */
|
int dirfd, /* Directory file descriptor */
|
||||||
sqlite3_file *pId, /* Write completed initialization here */
|
sqlite3_file *pId, /* Write to the unixFile structure here */
|
||||||
const char *zFilename, /* Name of the file being opened */
|
const char *zFilename /* Name of the file being opened */
|
||||||
){
|
){
|
||||||
sqlite3LockingStyle lockingStyle;
|
sqlite3LockingStyle lockingStyle;
|
||||||
unixFile *pNew = (unixFile *)pId;
|
unixFile *pNew = (unixFile *)pId;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset(pNew, 0, sizeof(unixFile));
|
#ifdef FD_CLOEXEC
|
||||||
|
fcntl(h, F_SETFD, fcntl(h, F_GETFD, 0) | FD_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
|
||||||
lockingStyle = sqlite3DetectLockingStyle(zFilename, h);
|
lockingStyle = sqlite3DetectLockingStyle(zFilename, h);
|
||||||
if ( lockingStyle == posixLockingStyle ) {
|
if ( lockingStyle == posixLockingStyle ) {
|
||||||
|
|
||||||
enterMutex();
|
enterMutex();
|
||||||
rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
|
rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
|
||||||
leaveMutex();
|
leaveMutex();
|
||||||
if( rc ){
|
if( rc ){
|
||||||
|
if( dirfd>=0 ) close(dirfd);
|
||||||
close(h);
|
close(h);
|
||||||
unlink(zFilename);
|
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2190,18 +2196,13 @@ static int fillInUnixFile(
|
|||||||
pNew->pLock = NULL;
|
pNew->pLock = NULL;
|
||||||
pNew->pOpen = NULL;
|
pNew->pOpen = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSTRACE3("OPEN %-3d %s\n", h, zFilename);
|
||||||
pNew->dirfd = -1;
|
pNew->dirfd = -1;
|
||||||
pNew->h = h;
|
pNew->h = h;
|
||||||
|
pNew->dirfd = dirfd;
|
||||||
SET_THREADID(pNew);
|
SET_THREADID(pNew);
|
||||||
pNew = sqlite3_malloc( sizeof(unixFile) );
|
|
||||||
if( pNew==0 ){
|
|
||||||
close(h);
|
|
||||||
enterMutex();
|
|
||||||
releaseLockInfo(pNew->pLock);
|
|
||||||
releaseOpenCnt(pNew->pOpen);
|
|
||||||
leaveMutex();
|
|
||||||
return SQLITE_NOMEM;
|
|
||||||
}else{
|
|
||||||
switch(lockingStyle) {
|
switch(lockingStyle) {
|
||||||
case afpLockingStyle: {
|
case afpLockingStyle: {
|
||||||
/* afp locking uses the file path so it needs to be included in
|
/* afp locking uses the file path so it needs to be included in
|
||||||
@ -2249,7 +2250,6 @@ static int fillInUnixFile(
|
|||||||
OpenCounter(+1);
|
OpenCounter(+1);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else /* SQLITE_ENABLE_LOCKING_STYLE */
|
#else /* SQLITE_ENABLE_LOCKING_STYLE */
|
||||||
static int fillInUnixFile(
|
static int fillInUnixFile(
|
||||||
int h, /* Open file descriptor on file being opened */
|
int h, /* Open file descriptor on file being opened */
|
||||||
|
Loading…
Reference in New Issue
Block a user