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

Add a table of shared-memory lock offsets in a comment in the os_unix.c code.

Include some assert()s to help verify the numbers.

FossilOrigin-Name: b480aacb3430a789d98ffd81a1886bbbc3cda5b0e736ec9a3e2b463db2a3b3ad
This commit is contained in:
drh
2021-05-19 16:55:28 +00:00
parent 3d691fd9ff
commit 187e2e48a8
3 changed files with 23 additions and 8 deletions

View File

@@ -8067,6 +8067,21 @@ int sqlite3_os_init(void){
sqlite3_vfs_register(&aVfs[i], i==0);
}
unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
/* Validate lock assumptions */
assert( SQLITE_SHM_NLOCK==8 ); /* Number of available locks */
assert( UNIX_SHM_BASE==120 ); /* Start of locking area */
/* Locks:
/* WRITE UNIX_SHM_BASE 120 */
/* CKPT UNIX_SHM_BASE+1 121 */
/* RECOVER UNIX_SHM_BASE+2 122 */
/* READ-0 UNIX_SHM_BASE+3 123 */
/* READ-1 UNIX_SHM_BASE+4 124 */
/* READ-2 UNIX_SHM_BASE+5 125 */
/* READ-3 UNIX_SHM_BASE+6 126 */
/* READ-4 UNIX_SHM_BASE+7 127 */
/* DMS UNIX_SHM_BASE+8 128 */
assert( UNIX_SHM_DMS==128 ); /* Byte offset of the deadman-switch */
return SQLITE_OK;
}