aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/os_unix.c19
-rw-r--r--src/sqlite.h.in10
-rw-r--r--src/test_devsym.c39
-rw-r--r--src/wal.c14
4 files changed, 53 insertions, 29 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index cb3e19009..ad95c1016 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5072,11 +5072,16 @@ shm_open_err:
** Close a connection to shared-memory. Delete the underlying
** storage if deleteFlag is true.
*/
-static int unixShmClose(sqlite3_shm *pSharedMem, int deleteFlag){
+static int unixShmClose(
+ sqlite3_vfs *pVfs, /* The VFS */
+ sqlite3_shm *pSharedMem, /* The shared-memory to be closed */
+ int deleteFlag /* Delete after closing if true */
+){
unixShm *p; /* The connection to be closed */
unixShmFile *pFile; /* The underlying shared-memory file */
unixShm **pp; /* For looping over sibling connections */
+ UNUSED_PARAMETER(pVfs);
if( pSharedMem==0 ) return SQLITE_OK;
p = (struct unixShm*)pSharedMem;
pFile = p->pFile;
@@ -5123,6 +5128,7 @@ static int unixShmClose(sqlite3_shm *pSharedMem, int deleteFlag){
** is free to expand the storage to some larger amount if it chooses.
*/
static int unixShmSize(
+ sqlite3_vfs *pVfs, /* The VFS */
sqlite3_shm *pSharedMem, /* Pointer returned by unixShmOpen() */
int reqSize, /* Requested size. -1 for query only */
int *pNewSize /* Write new size here */
@@ -5132,6 +5138,8 @@ static int unixShmSize(
int rc = SQLITE_OK;
struct stat sStat;
+ UNUSED_PARAMETER(pVfs);
+
if( reqSize>=0 ){
reqSize = (reqSize + SQLITE_UNIX_SHM_INCR - 1)/SQLITE_UNIX_SHM_INCR;
reqSize *= SQLITE_UNIX_SHM_INCR;
@@ -5174,6 +5182,7 @@ static int unixShmSize(
** yet been allocated to the underlying storage.
*/
static int unixShmGet(
+ sqlite3_vfs *pVfs, /* The VFS */
sqlite3_shm *pSharedMem, /* Pointer returned by unixShmOpen() */
int reqMapSize, /* Requested size of mapping. -1 means don't care */
int *pNewMapSize, /* Write new size of mapping here */
@@ -5191,7 +5200,7 @@ static int unixShmGet(
sqlite3_mutex_enter(pFile->mutex);
if( pFile->szMap==0 || reqMapSize>pFile->szMap ){
int actualSize;
- if( unixShmSize(pSharedMem, -1, &actualSize)==SQLITE_OK
+ if( unixShmSize(pVfs, pSharedMem, -1, &actualSize)==SQLITE_OK
&& reqMapSize<actualSize
){
reqMapSize = actualSize;
@@ -5219,8 +5228,9 @@ static int unixShmGet(
** really want to release the lock, so in that case too, this routine
** is a no-op.
*/
-static int unixShmRelease(sqlite3_shm *pSharedMem){
+static int unixShmRelease(sqlite3_vfs *pVfs, sqlite3_shm *pSharedMem){
unixShm *p = (unixShm*)pSharedMem;
+ UNUSED_PARAMETER(pVfs);
if( p->hasMutexBuf && p->lockState!=SQLITE_SHM_RECOVER ){
unixShmFile *pFile = p->pFile;
assert( sqlite3_mutex_notheld(pFile->mutex) );
@@ -5250,6 +5260,7 @@ static const char *azLkName[] = {
** Change the lock state for a shared-memory segment.
*/
static int unixShmLock(
+ sqlite3_vfs *pVfs, /* The VFS */
sqlite3_shm *pSharedMem, /* Pointer from unixShmOpen() */
int desiredLock, /* One of SQLITE_SHM_xxxxx locking states */
int *pGotLock /* The lock you actually got */
@@ -5258,6 +5269,8 @@ static int unixShmLock(
unixShmFile *pFile = p->pFile;
int rc = SQLITE_PROTOCOL;
+ UNUSED_PARAMETER(pVfs);
+
/* Note that SQLITE_SHM_READ_FULL and SQLITE_SHM_PENDING are never
** directly requested; they are side effects from requesting
** SQLITE_SHM_READ and SQLITE_SHM_CHECKPOINT, respectively.
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index fab90180d..f31c10ec2 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -844,11 +844,11 @@ struct sqlite3_vfs {
** definition. Those that follow are added in version 2 or later
*/
int (*xShmOpen)(sqlite3_vfs*, const char *zName, sqlite3_shm**);
- int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize);
- int (*xShmGet)(sqlite3_shm*, int reqMapSize, int *pMapSize, void**);
- int (*xShmRelease)(sqlite3_shm*);
- int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock);
- int (*xShmClose)(sqlite3_shm*, int deleteFlag);
+ int (*xShmSize)(sqlite3_vfs*, sqlite3_shm*, int reqSize, int *pNewSize);
+ int (*xShmGet)(sqlite3_vfs*, sqlite3_shm*, int reqSize, int *pSize, void**);
+ int (*xShmRelease)(sqlite3_vfs*, sqlite3_shm*);
+ int (*xShmLock)(sqlite3_vfs*, sqlite3_shm*, int desiredLock, int *gotLock);
+ int (*xShmClose)(sqlite3_vfs*, sqlite3_shm*, int deleteFlag);
int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
/*
diff --git a/src/test_devsym.c b/src/test_devsym.c
index 118af8b08..082d101d4 100644
--- a/src/test_devsym.c
+++ b/src/test_devsym.c
@@ -69,11 +69,11 @@ static int devsymSleep(sqlite3_vfs*, int microseconds);
static int devsymCurrentTime(sqlite3_vfs*, double*);
static int devsymShmOpen(sqlite3_vfs *, const char *, sqlite3_shm **);
-static int devsymShmSize(sqlite3_shm *, int , int *);
-static int devsymShmGet(sqlite3_shm *, int , int *, void **);
-static int devsymShmRelease(sqlite3_shm *);
-static int devsymShmLock(sqlite3_shm *, int , int *);
-static int devsymShmClose(sqlite3_shm *, int);
+static int devsymShmSize(sqlite3_vfs*, sqlite3_shm *, int , int *);
+static int devsymShmGet(sqlite3_vfs*, sqlite3_shm *, int , int *, void **);
+static int devsymShmRelease(sqlite3_vfs*, sqlite3_shm *);
+static int devsymShmLock(sqlite3_vfs*, sqlite3_shm *, int , int *);
+static int devsymShmClose(sqlite3_vfs*, sqlite3_shm *, int);
static sqlite3_vfs devsym_vfs = {
2, /* iVersion */
@@ -357,25 +357,36 @@ static int devsymShmOpen(
){
return g.pVfs->xShmOpen(g.pVfs, zName, pp);
}
-static int devsymShmSize(sqlite3_shm *p, int reqSize, int *pNewSize){
- return g.pVfs->xShmSize(p, reqSize, pNewSize);
+static int devsymShmSize(
+ sqlite3_vfs *pVfs,
+ sqlite3_shm *p,
+ int reqSize,
+ int *pNewSize
+){
+ return g.pVfs->xShmSize(g.pVfs, p, reqSize, pNewSize);
}
static int devsymShmGet(
+ sqlite3_vfs *pVfs,
sqlite3_shm *p,
int reqMapSize,
int *pMapSize,
void **pp
){
- return g.pVfs->xShmGet(p, reqMapSize, pMapSize, pp);
+ return g.pVfs->xShmGet(g.pVfs, p, reqMapSize, pMapSize, pp);
}
-static int devsymShmRelease(sqlite3_shm *p){
- return g.pVfs->xShmRelease(p);
+static int devsymShmRelease(sqlite3_vfs *pVfs, sqlite3_shm *p){
+ return g.pVfs->xShmRelease(g.pVfs, p);
}
-static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
- return g.pVfs->xShmLock(p, desiredLock, gotLock);
+static int devsymShmLock(
+ sqlite3_vfs *pVfs,
+ sqlite3_shm *p,
+ int desiredLock,
+ int *gotLock
+){
+ return g.pVfs->xShmLock(g.pVfs, p, desiredLock, gotLock);
}
-static int devsymShmClose(sqlite3_shm *p, int deleteFlag){
- return g.pVfs->xShmClose(p, deleteFlag);
+static int devsymShmClose(sqlite3_vfs *pVfs, sqlite3_shm *p, int deleteFlag){
+ return g.pVfs->xShmClose(g.pVfs, p, deleteFlag);
}
/*
diff --git a/src/wal.c b/src/wal.c
index 071521001..f412a39e4 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -219,7 +219,7 @@ static void walChecksumBytes(u8 *aByte, int nByte, u32 *aCksum){
static int walSetLock(Wal *pWal, int desiredStatus){
int rc, got;
if( pWal->lockState==desiredStatus ) return SQLITE_OK;
- rc = pWal->pVfs->xShmLock(pWal->pWIndex, desiredStatus, &got);
+ rc = pWal->pVfs->xShmLock(pWal->pVfs, pWal->pWIndex, desiredStatus, &got);
pWal->lockState = got;
if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
pWal->readerType = got;
@@ -375,7 +375,7 @@ static int walIndexEntry(u32 iFrame){
*/
static void walIndexUnmap(Wal *pWal){
if( pWal->pWiData ){
- pWal->pVfs->xShmRelease(pWal->pWIndex);
+ pWal->pVfs->xShmRelease(pWal->pVfs, pWal->pWIndex);
pWal->pWiData = 0;
}
}
@@ -390,8 +390,8 @@ static void walIndexUnmap(Wal *pWal){
static int walIndexMap(Wal *pWal, int reqSize){
int rc = SQLITE_OK;
if( pWal->pWiData==0 ){
- rc = pWal->pVfs->xShmGet(pWal->pWIndex, reqSize, &pWal->szWIndex,
- (void**)(char*)&pWal->pWiData);
+ rc = pWal->pVfs->xShmGet(pWal->pVfs, pWal->pWIndex, reqSize,
+ &pWal->szWIndex, (void**)(char*)&pWal->pWiData);
if( rc==SQLITE_OK && pWal->pWiData==0 ){
/* Make sure pWal->pWiData is not NULL while we are holding the
** lock on the mapping. */
@@ -412,7 +412,7 @@ static int walIndexMap(Wal *pWal, int reqSize){
static int walIndexRemap(Wal *pWal, int enlargeTo){
int rc;
int sz;
- rc = pWal->pVfs->xShmSize(pWal->pWIndex, enlargeTo, &sz);
+ rc = pWal->pVfs->xShmSize(pWal->pVfs, pWal->pWIndex, enlargeTo, &sz);
if( rc==SQLITE_OK && sz>pWal->szWIndex ){
walIndexUnmap(pWal);
rc = walIndexMap(pWal, sz);
@@ -607,7 +607,7 @@ int sqlite3WalOpen(
wal_open_out:
if( rc!=SQLITE_OK ){
if( pRet ){
- pVfs->xShmClose(pRet->pWIndex, 0);
+ pVfs->xShmClose(pVfs, pRet->pWIndex, 0);
sqlite3OsClose(pRet->pFd);
sqlite3_free(pRet);
}
@@ -805,7 +805,7 @@ int sqlite3WalClose(
walIndexUnmap(pWal);
}
- pWal->pVfs->xShmClose(pWal->pWIndex, isDelete);
+ pWal->pVfs->xShmClose(pWal->pVfs, pWal->pWIndex, isDelete);
sqlite3OsClose(pWal->pFd);
if( isDelete ){
sqlite3OsDelete(pWal->pVfs, pWal->zName, 0);