aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <>2021-05-19 16:55:28 +0000
committerdrh <>2021-05-19 16:55:28 +0000
commit187e2e48a81fdc1ae4e7d18a097b149d6f7bd705 (patch)
treed03f76f74d92e1c65e051c754edd86eb2873467e /src/os_unix.c
parent3d691fd9ff63368d78125e0cee60601c90a2853c (diff)
downloadsqlite-187e2e48a81fdc1ae4e7d18a097b149d6f7bd705.tar.gz
sqlite-187e2e48a81fdc1ae4e7d18a097b149d6f7bd705.zip
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
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index adc89f5a7..76b4497a6 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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;
}