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

Changes to the interface design for the xShmLock method of the VFS.

FossilOrigin-Name: 348409de26eafe12f5cb1236e8e167a4183d4051
This commit is contained in:
drh
2010-04-28 17:21:33 +00:00
parent 833bf968e3
commit 9beb1584bd
4 changed files with 29 additions and 42 deletions

View File

@@ -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;
}
/*