1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

The first 6 WAL tests now work. It's a start.

FossilOrigin-Name: a92c1851da10acf51e7f6f086b8a23bd731940b3
This commit is contained in:
drh
2010-04-30 02:13:26 +00:00
parent 7ed91f2344
commit 79e6c78ccc
4 changed files with 40 additions and 33 deletions

View File

@@ -4710,7 +4710,7 @@ static int unixShmSystemLock(
u8 mask; /* Mask of bits in lockMask */
/* Access to the unixShmFile object is serialized by the caller */
assert( sqlite3_mutex_held(pFile->mutex) );
assert( sqlite3_mutex_held(pFile->mutex) || pFile->nRef==0 );
/* Initialize the locking parameters */
memset(&f, 0, sizeof(f));
@@ -4732,13 +4732,15 @@ static int unixShmSystemLock(
mask <<= 1;
while( mask!=0 && (lockMask & mask)!=0 ){
f.l_len++;
mask <<= 1;
}
/* Verify that all bits set in lockMask are contiguous */
assert( mask==0 || (lockMask & ~(mask | (mask-1)))==0 );
/* Acquire the system-level lock */
rc = (fcntl(pFile->h, lockOp, &f)==0) ? SQLITE_OK : SQLITE_BUSY;
rc = fcntl(pFile->h, lockOp, &f);
rc = (rc!=(-1)) ? SQLITE_OK : SQLITE_BUSY;
/* Update the global lock state and do debug tracing */
#ifdef SQLITE_DEBUG
@@ -4793,9 +4795,6 @@ static int unixShmUnlock(
/* Access to the unixShmFile object is serialized by the caller */
assert( sqlite3_mutex_held(pFile->mutex) );
/* We never try to unlock locks that we do not hold */
assert( ((p->exclMask|p->sharedMask) & unlockMask)==unlockMask );
/* Compute locks held by sibling connections */
for(pX=pFile->pFirst; pX; pX=pX->pNext){
if( pX==p ) continue;
@@ -4960,7 +4959,7 @@ static int unixShmOpen(
rc = SQLITE_NOMEM;
goto shm_open_err;
}
memset(pFile, 0, sizeof(pFile));
memset(pFile, 0, sizeof(*pFile));
pFile->zFilename = (char*)&pFile[1];
memcpy(pFile->zFilename, zName, nName+1);
pFile->h = -1;
@@ -4983,7 +4982,7 @@ static int unixShmOpen(
goto shm_open_err;
}
pFile->h = open(zName, O_CREAT, 0664);
pFile->h = open(zName, O_RDWR|O_CREAT, 0664);
if( pFile->h<0 ){
rc = SQLITE_CANTOPEN;
goto shm_open_err;