diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/os_unix.c | 23 | ||||
-rw-r--r-- | src/sqlite.h.in | 28 |
2 files changed, 19 insertions, 32 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index d603caa0d..7e3930a1e 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 225007780..9f6f1bc96 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 |