diff options
author | drh <drh@noemail.net> | 2010-04-30 16:48:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-04-30 16:48:19 +0000 |
commit | 400df2ea70f47060dd8c30852931b32d994881da (patch) | |
tree | 180732c482b465bcfb560b149efe9150d9c4814e /src/os_unix.c | |
parent | 43a56b812c6faf2069b428c84fb91c368eda4894 (diff) | |
download | sqlite-400df2ea70f47060dd8c30852931b32d994881da.tar.gz sqlite-400df2ea70f47060dd8c30852931b32d994881da.zip |
In the debugging output for SHM-LOCK in os_unix.c, use symbolic names
for the lock states rather than raw numbers.
FossilOrigin-Name: 2afc33de2b2012d034fb0d2057a5a45e304516ca
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a85d7a61b..483978673 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5173,6 +5173,20 @@ static int unixShmRelease(sqlite3_shm *pSharedMem){ return SQLITE_OK; } +/* +** Symbolic names for LOCK states used for debugging. +*/ +#ifdef SQLITE_DEBUG +static const char *azLkName[] = { + "UNLOCK", + "READ", + "READ_FULL", + "WRITE", + "PENDING", + "CHECKPOINT", + "RECOVER" +}; +#endif /* @@ -5205,14 +5219,14 @@ static int unixShmLock( || desiredLock==p->lockState || (desiredLock==SQLITE_SHM_READ && p->lockState==SQLITE_SHM_READ_FULL) ){ - OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %d and got %d\n", - p->id, getpid(), desiredLock, p->lockState)); + OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %s and got %s\n", + p->id, getpid(), azLkName[desiredLock], azLkName[p->lockState])); if( pGotLock ) *pGotLock = p->lockState; return SQLITE_OK; } - OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %d->%d\n", - p->id, getpid(), p->lockState, desiredLock)); + OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %s->%s\n", + p->id, getpid(), azLkName[p->lockState], azLkName[desiredLock])); sqlite3_mutex_enter(pFile->mutex); switch( desiredLock ){ case SQLITE_SHM_UNLOCK: { @@ -5301,7 +5315,8 @@ static int unixShmLock( } } sqlite3_mutex_leave(pFile->mutex); - OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %d\n", p->id,getpid(),p->lockState)); + OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %s\n", + p->id, getpid(), azLkName[p->lockState])); if( pGotLock ) *pGotLock = p->lockState; return rc; } |