From 9beb1584bd2e1ea3dfdf3ff08ae78e96f1c1e37d Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 28 Apr 2010 17:21:33 +0000 Subject: [PATCH] Changes to the interface design for the xShmLock method of the VFS. FossilOrigin-Name: 348409de26eafe12f5cb1236e8e167a4183d4051 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/os_unix.c | 23 ++++------------------- src/sqlite.h.in | 28 +++++++++++++++------------- 4 files changed, 30 insertions(+), 43 deletions(-) diff --git a/manifest b/manifest index fec9e7d250..e87f3103a8 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Rename\sthe\ssqlite3_log_hook()\sto\ssqlite3_wal_hook().\s\sAdded\scomments\sto\nwal.h. -D 2010-04-28T14:42:19 +C Changes\sto\sthe\sinterface\sdesign\sfor\sthe\sxShmLock\smethod\sof\sthe\sVFS. +D 2010-04-28T17:21:33 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -153,7 +153,7 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306 F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30 F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0 -F src/os_unix.c 332ff9185aedcbd25568a06ddbdb51f5496b9756 +F src/os_unix.c c8b7d1e0f4315e08cf54324ca706e1a1a80f5fc2 F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1 F src/pager.c b4a41030860229e80295fa1f37addab24d21799c F src/pager.h cee4487ab4f0911dd9f22a40e3cd55afdb7ef444 @@ -169,7 +169,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4 -F src/sqlite.h.in 9529106a7608b57bbe9e290cdddb203bd383f888 +F src/sqlite.h.in caf60df0991a14e22cce8243b9caa1c1dbd09d42 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 F src/sqliteInt.h 700a2df7b8dfe57c3b8d83c52ff40928e026220c F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 @@ -811,14 +811,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 8c2d43babd61fe2225d5c402174253f412604092 -R d2467063cf37b05312bd03bb938b0ac5 +P bbc385111b19071e20fe963fab814262c815b3e9 +R 8707e56d2016564dc168df33cbfc8185 U drh -Z 7c95869a158e03c8e63f0877555a0133 +Z 76427138e798af79dc3cb019d4766cfc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFL2ElOoxKgR168RlERAmaCAJ0cROgoBzwR39dDYWGzjUDfWHeq+ACfdKsQ -SQEr/7S7IaJ1k5L/fD6AU0g= -=eywR +iD8DBQFL2G6foxKgR168RlERAj6qAJ4tUzbbIOEurzGhDqNlV4AMpvLtEgCfaPHT +5y4JLRgmNxCyywDyaIJzD+o= +=+YQ0 -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 9760418781..aa96371448 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bbc385111b19071e20fe963fab814262c815b3e9 \ No newline at end of file +348409de26eafe12f5cb1236e8e167a4183d4051 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index d603caa0d0..7e3930a1e6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4697,26 +4697,11 @@ static int unixShmRelease(sqlite3_shm *pSharedMem){ */ static int unixShmLock( sqlite3_shm *pSharedMem, /* Pointer from unixShmOpen() */ - int lockType, /* _RDLK, _WRLK, or _UNLK, possibly ORed _BLOCK */ - int ofst, /* Start of lock region */ - int nByte /* Size of lock region in bytes */ + int desiredLock, /* The locking state desired */ + int *pGotLock, /* The locking state actually obtained */ + int shouldBlock /* Block for the lock if true and possible */ ){ - struct unixShm *p = (struct unixShm*)pSharedMem; - struct flock f; - int op; - int rc; - - f.l_whence = SEEK_SET; - f.l_start = ofst; - f.l_len = nByte; - switch( lockType & 0x07 ){ - case SQLITE_SHM_RDLK: f.l_type = F_RDLCK; break; - case SQLITE_SHM_WRLK: f.l_type = F_WRLCK; break; - case SQLITE_SHM_UNLK: f.l_type = F_UNLCK; break; - } - op = (lockType & 0x08)!=0 ? F_SETLKW : F_SETLK; - rc = fcntl(p->fd.h, op, &f); - return (rc==0) ? SQLITE_OK : SQLITE_BUSY; + return SQLITE_OK; } /* diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 225007780b..9f6f1bc967 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -848,7 +848,7 @@ struct sqlite3_vfs { int (*xShmRelease)(sqlite3_shm*); int (*xShmPush)(sqlite3_shm*); int (*xShmPull)(sqlite3_shm*); - int (*xShmLock)(sqlite3_shm*, int lockType, int ofst, int nByte); + int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock, int shouldBlock); int (*xShmClose)(sqlite3_shm*); int (*xShmDelete)(sqlite3_vfs*, const char *zName); int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync); @@ -880,18 +880,20 @@ struct sqlite3_vfs { /* ** CAPI3REF: Flags for the xShmLock VFS method ** -** These integer constants can be used as the second parameter to -** the xShmLock method of an [sqlite3_vfs] object. They determine -** the specific locking action. Exactly one of the first three -** values must be used ini the lockType parameter. The fourth -** value (SQLITE_SHM_BLOCK) can optionally be ORed into the lockType -** parameter to cause the thread to block until the lock becomes -** available. -*/ -#define SQLITE_SHM_RDLK 0x01 -#define SQLITE_SHM_WRLK 0x02 -#define SQLITE_SHM_UNLK 0x04 -#define SQLITE_SHM_BLOCK 0x08 +** These integer constants define the various locking states that +** an sqlite3_shm object can be in. The SQLITE_SHM_QUERY integer +** is not a valid data - it is a constant pasted to the +** sqlite3_vfs.xShmLock() method for querying the current lock +** state. +*/ +#define SQLITE_SHM_UNLOCK 0 +#define SQLITE_SHM_READ_PREFIX 1 +#define SQLITE_SHM_READ_FULL 2 +#define SQLITE_SHM_WRITE 3 +#define SQLITE_SHM_PENDING 4 +#define SQLITE_SHM_CHECKPOINT 5 +#define SQLITE_SHM_RECOVER 6 +#define SQLITE_SHM_QUERY (-1) /* ** CAPI3REF: Initialize The SQLite Library -- 2.47.2