mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Remove xShmGet/Size/Release from the sqlite3_vfs structure. Change the name of xShmPage to xShmMap. Remove some code that is now unused from os_unix.c and some of the test VFS implementations.
FossilOrigin-Name: fc0cabc15c97dde6a852b4f07df6d30f1d2c04bc
This commit is contained in:
28
manifest
28
manifest
@@ -1,5 +1,5 @@
|
||||
C Update\ssome\scomments\sin\swal.c.\sNo\scode\schanges.
|
||||
D 2010-06-14T11:49:26
|
||||
C Remove\sxShmGet/Size/Release\sfrom\sthe\ssqlite3_vfs\sstructure.\sChange\sthe\sname\sof\sxShmPage\sto\sxShmMap.\sRemove\ssome\scode\sthat\sis\snow\sunused\sfrom\sos_unix.c\sand\ssome\sof\sthe\stest\sVFS\simplementations.
|
||||
D 2010-06-14T14:07:51
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -150,11 +150,11 @@ F src/mutex_os2.c 6a62583e374ba3ac1a3fcc0da2bfdac7d3942689
|
||||
F src/mutex_unix.c cf84466b4fdd2baa0d5a10bb19f08b2abc1ce42e
|
||||
F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb
|
||||
F src/notify.c cbfa66a836da3a51567209636e6a94059c137930
|
||||
F src/os.c 00ab9dcdee6e33ff3d060744c86af25200c51e0f
|
||||
F src/os.h a0d2c1436cb6003e6da16001499a0b828f1edb34
|
||||
F src/os.c 9c4a2f82a50306a33907678ec0187b6ad1486bfe
|
||||
F src/os.h d7775504a51e6e0d40315aa427b3e229ff9ff9ca
|
||||
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
||||
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
|
||||
F src/os_unix.c 29dac62790ccea7db1516be3abb007988accb165
|
||||
F src/os_unix.c 0a57b86241011ca25f2fb83e4825b7af7fe6d920
|
||||
F src/os_win.c 0cf1f571546f165001e2391b5d4a4a16d86977d3
|
||||
F src/pager.c 2964185d4356d0dc159b8340e52d2538d32394e5
|
||||
F src/pager.h ca1f23c0cf137ac26f8908df2427c8b308361efd
|
||||
@@ -170,7 +170,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
|
||||
F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714
|
||||
F src/sqlite.h.in 092df034f4b426ffbb9e5bb905958fa35bbb7f7a
|
||||
F src/sqlite.h.in 6e8e9454f6ada979405543b19e0c18ca16fd020e
|
||||
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
||||
F src/sqliteInt.h 242987ebd2366ea36650a09cdab04a9163c62109
|
||||
F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
|
||||
@@ -182,7 +182,7 @@ F src/test2.c e3f564ab1e9fd0b47b0c9e23e7054e38bf0836cf
|
||||
F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94
|
||||
F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d
|
||||
F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1
|
||||
F src/test6.c 1b312541883ec9413734035deada4794ee339e67
|
||||
F src/test6.c 43d6ce22d77b22f8c580be40990be6fa204d7f4d
|
||||
F src/test7.c 3f2d63e4ccf97f8c2cf1a7fa0a3c8e2e2a354e6e
|
||||
F src/test8.c f959db9a22d882013b64c92753fa793b2ce3bdea
|
||||
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
|
||||
@@ -192,7 +192,7 @@ F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
||||
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
||||
F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f
|
||||
F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27
|
||||
F src/test_devsym.c cf64a4b602ccde10c9261283d1b9be12f4c4a0ea
|
||||
F src/test_devsym.c b2c821471efb0f3680de0c60fbe1ac673517ddd6
|
||||
F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
|
||||
F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
|
||||
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
|
||||
@@ -203,13 +203,13 @@ F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
||||
F src/test_malloc.c 2842c922b8e8d992aba722214952204ca025b411
|
||||
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
|
||||
F src/test_onefile.c 4ce8c753c0240f010f0f2af89604875967d20945
|
||||
F src/test_osinst.c a0df974ab32f9aae97da5ce094301926cffcdc17
|
||||
F src/test_osinst.c 0d3d47cf3a8a0b4db9a5d0255b9d74c671ca19b4
|
||||
F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8
|
||||
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
||||
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
|
||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||
F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726
|
||||
F src/test_vfs.c 15bddcddf6b1bf6360130e09aee950f5f563d5f3
|
||||
F src/test_vfs.c 8e125e01b4f88c6a2e131d5a65d15f5c96d665f1
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
|
||||
F src/trigger.c 8927588cb9e6d47f933b53bfe74200fbb504100d
|
||||
@@ -226,7 +226,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
|
||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||
F src/wal.c f8ba403da99ed5f2260f03cd01c3f10fe8155e67
|
||||
F src/wal.c c261aeb28c9b40f4713bace3c1c0cee9dcba87ab
|
||||
F src/wal.h 4ace25262452d17e7d3ec970c89ee17794004008
|
||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||
F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56
|
||||
@@ -820,7 +820,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 5e8e2e978ea48ce4ad93a936c838934f33d665df
|
||||
R 4612706a9d4bf144a165ca75ff4d4a89
|
||||
P 1ce9c92bffa5d7f8431c005b29d698b0f5b95875
|
||||
R 8ee76bbe532e6db3f47bf2104ddf1a48
|
||||
U dan
|
||||
Z d61a90eb1d7a0bbf02b4e4817b07d279
|
||||
Z 95a9a1111fae03b142846d91ecde0c57
|
||||
|
@@ -1 +1 @@
|
||||
1ce9c92bffa5d7f8431c005b29d698b0f5b95875
|
||||
fc0cabc15c97dde6a852b4f07df6d30f1d2c04bc
|
13
src/os.c
13
src/os.c
@@ -101,15 +101,6 @@ int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
|
||||
int sqlite3OsShmOpen(sqlite3_file *id){
|
||||
return id->pMethods->xShmOpen(id);
|
||||
}
|
||||
int sqlite3OsShmSize(sqlite3_file *id, int reqSize, int *pNewSize){
|
||||
return id->pMethods->xShmSize(id, reqSize, pNewSize);
|
||||
}
|
||||
int sqlite3OsShmGet(sqlite3_file *id,int reqSize,int *pSize,void volatile **pp){
|
||||
return id->pMethods->xShmGet(id, reqSize, pSize, pp);
|
||||
}
|
||||
int sqlite3OsShmRelease(sqlite3_file *id){
|
||||
return id->pMethods->xShmRelease(id);
|
||||
}
|
||||
int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){
|
||||
return id->pMethods->xShmLock(id, offset, n, flags);
|
||||
}
|
||||
@@ -119,14 +110,14 @@ void sqlite3OsShmBarrier(sqlite3_file *id){
|
||||
int sqlite3OsShmClose(sqlite3_file *id, int deleteFlag){
|
||||
return id->pMethods->xShmClose(id, deleteFlag);
|
||||
}
|
||||
int sqlite3OsShmPage(
|
||||
int sqlite3OsShmMap(
|
||||
sqlite3_file *id,
|
||||
int iPage,
|
||||
int pgsz,
|
||||
int isWrite,
|
||||
void volatile **pp
|
||||
){
|
||||
return id->pMethods->xShmPage(id, iPage, pgsz, isWrite, pp);
|
||||
return id->pMethods->xShmMap(id, iPage, pgsz, isWrite, pp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
5
src/os.h
5
src/os.h
@@ -248,13 +248,10 @@ int sqlite3OsFileControl(sqlite3_file*,int,void*);
|
||||
int sqlite3OsSectorSize(sqlite3_file *id);
|
||||
int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
|
||||
int sqlite3OsShmOpen(sqlite3_file *id);
|
||||
int sqlite3OsShmSize(sqlite3_file *id, int, int*);
|
||||
int sqlite3OsShmGet(sqlite3_file *id, int, int*, void volatile**);
|
||||
int sqlite3OsShmRelease(sqlite3_file *id);
|
||||
int sqlite3OsShmLock(sqlite3_file *id, int, int, int);
|
||||
void sqlite3OsShmBarrier(sqlite3_file *id);
|
||||
int sqlite3OsShmClose(sqlite3_file *id, int);
|
||||
int sqlite3OsShmPage(sqlite3_file *,int,int,int,void volatile **);
|
||||
int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);
|
||||
|
||||
/*
|
||||
** Functions for accessing sqlite3_vfs methods
|
||||
|
261
src/os_unix.c
261
src/os_unix.c
@@ -3128,27 +3128,15 @@ static int unixDeviceCharacteristics(sqlite3_file *NotUsed){
|
||||
** Either unixShmNode.mutex must be held or unixShmNode.nRef==0 and
|
||||
** unixMutexHeld() is true when reading or writing any other field
|
||||
** in this structure.
|
||||
**
|
||||
** To avoid deadlocks, mutex and mutexBuf are always released in the
|
||||
** reverse order that they are acquired. mutexBuf is always acquired
|
||||
** first and released last. This invariant is check by asserting
|
||||
** sqlite3_mutex_notheld() on mutex whenever mutexBuf is acquired or
|
||||
** released.
|
||||
*/
|
||||
struct unixShmNode {
|
||||
unixInodeInfo *pInode; /* unixInodeInfo that owns this SHM node */
|
||||
sqlite3_mutex *mutex; /* Mutex to access this object */
|
||||
sqlite3_mutex *mutexBuf; /* Mutex to access zBuf[] */
|
||||
char *zFilename; /* Name of the mmapped file */
|
||||
int h; /* Open file descriptor */
|
||||
|
||||
int szMap; /* Size of the mapping into memory */
|
||||
char *pMMapBuf; /* Where currently mmapped(). NULL if unmapped */
|
||||
|
||||
int pgsz; /* Size of shared-memory pages */
|
||||
int nPage; /* Size of array apPage */
|
||||
char **apPage; /* Array of mapped shared-memory pages */
|
||||
|
||||
int szRegion; /* Size of shared-memory regions */
|
||||
int nRegion; /* Size of array apRegion */
|
||||
char **apRegion; /* Array of mapped shared-memory regions */
|
||||
int nRef; /* Number of unixShm objects pointing to this */
|
||||
unixShm *pFirst; /* All unixShm objects pointing to this */
|
||||
#ifdef SQLITE_DEBUG
|
||||
@@ -3175,7 +3163,6 @@ struct unixShm {
|
||||
unixShmNode *pShmNode; /* The underlying unixShmNode object */
|
||||
unixShm *pNext; /* Next unixShm with the same unixShmNode */
|
||||
u8 hasMutex; /* True if holding the unixShmNode mutex */
|
||||
u8 hasMutexBuf; /* True if holding pFile->mutexBuf */
|
||||
u16 sharedMask; /* Mask of shared locks held */
|
||||
u16 exclMask; /* Mask of exclusive locks held */
|
||||
#ifdef SQLITE_DEBUG
|
||||
@@ -3275,12 +3262,10 @@ static void unixShmPurge(unixFile *pFd){
|
||||
int i;
|
||||
assert( p->pInode==pFd->pInode );
|
||||
if( p->mutex ) sqlite3_mutex_free(p->mutex);
|
||||
if( p->mutexBuf ) sqlite3_mutex_free(p->mutexBuf);
|
||||
if( p->pMMapBuf ) munmap(p->pMMapBuf, p->szMap);
|
||||
for(i=0; i<p->nPage; i++){
|
||||
munmap(p->apPage[i], p->pgsz);
|
||||
for(i=0; i<p->nRegion; i++){
|
||||
munmap(p->apRegion[i], p->szRegion);
|
||||
}
|
||||
sqlite3_free(p->apPage);
|
||||
sqlite3_free(p->apRegion);
|
||||
if( p->h>=0 ) close(p->h);
|
||||
p->pInode->pShmNode = 0;
|
||||
sqlite3_free(p);
|
||||
@@ -3356,11 +3341,6 @@ static int unixShmOpen(
|
||||
rc = SQLITE_NOMEM;
|
||||
goto shm_open_err;
|
||||
}
|
||||
pShmNode->mutexBuf = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
|
||||
if( pShmNode->mutexBuf==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
goto shm_open_err;
|
||||
}
|
||||
|
||||
pShmNode->h = open(pShmNode->zFilename, O_RDWR|O_CREAT, 0664);
|
||||
if( pShmNode->h<0 ){
|
||||
@@ -3431,7 +3411,6 @@ static int unixShmClose(
|
||||
*pp = p->pNext;
|
||||
|
||||
/* Free the connection p */
|
||||
assert( p->hasMutexBuf==0 );
|
||||
sqlite3_free(p);
|
||||
pDbFd->pShm = 0;
|
||||
sqlite3_mutex_leave(pShmNode->mutex);
|
||||
@@ -3450,148 +3429,6 @@ static int unixShmClose(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Changes the size of the underlying storage for a shared-memory segment.
|
||||
**
|
||||
** The reqSize parameter is the new requested size of the shared memory.
|
||||
** This implementation is free to increase the shared memory size to
|
||||
** any amount greater than or equal to reqSize. If the shared memory is
|
||||
** already as big or bigger as reqSize, this routine is a no-op.
|
||||
**
|
||||
** The reqSize parameter is the minimum size requested. The implementation
|
||||
** is free to expand the storage to some larger amount if it chooses.
|
||||
*/
|
||||
static int unixShmSize(
|
||||
sqlite3_file *fd, /* The open database file holding SHM */
|
||||
int reqSize, /* Requested size. -1 for query only */
|
||||
int *pNewSize /* Write new size here */
|
||||
){
|
||||
unixFile *pDbFd = (unixFile*)fd;
|
||||
unixShm *p = pDbFd->pShm;
|
||||
unixShmNode *pShmNode = p->pShmNode;
|
||||
int rc = SQLITE_OK;
|
||||
struct stat sStat;
|
||||
|
||||
assert( pShmNode==pDbFd->pInode->pShmNode );
|
||||
assert( pShmNode->pInode==pDbFd->pInode );
|
||||
|
||||
while( 1 ){
|
||||
if( fstat(pShmNode->h, &sStat)==0 ){
|
||||
*pNewSize = (int)sStat.st_size;
|
||||
if( reqSize<=(int)sStat.st_size ) break;
|
||||
}else{
|
||||
*pNewSize = 0;
|
||||
rc = SQLITE_IOERR_SHMSIZE;
|
||||
break;
|
||||
}
|
||||
rc = ftruncate(pShmNode->h, reqSize);
|
||||
reqSize = -1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Release the lock held on the shared memory segment to that other
|
||||
** threads are free to resize it if necessary.
|
||||
**
|
||||
** If the lock is not currently held, this routine is a harmless no-op.
|
||||
**
|
||||
** If the shared-memory object is in lock state RECOVER, then we do not
|
||||
** really want to release the lock, so in that case too, this routine
|
||||
** is a no-op.
|
||||
*/
|
||||
static int unixShmRelease(sqlite3_file *fd){
|
||||
unixFile *pDbFd = (unixFile*)fd;
|
||||
unixShm *p = pDbFd->pShm;
|
||||
|
||||
if( p->hasMutexBuf ){
|
||||
assert( sqlite3_mutex_notheld(p->pShmNode->mutex) );
|
||||
sqlite3_mutex_leave(p->pShmNode->mutexBuf);
|
||||
p->hasMutexBuf = 0;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Map the shared storage into memory.
|
||||
**
|
||||
** If reqMapSize is positive, then an attempt is made to make the
|
||||
** mapping at least reqMapSize bytes in size. However, the mapping
|
||||
** will never be larger than the size of the underlying shared memory
|
||||
** as set by prior calls to xShmSize().
|
||||
**
|
||||
** *ppBuf is made to point to the memory which is a mapping of the
|
||||
** underlying storage. A mutex is acquired to prevent other threads
|
||||
** from running while *ppBuf is in use in order to prevent other threads
|
||||
** remapping *ppBuf out from under this thread. The unixShmRelease()
|
||||
** call will release the mutex. However, if the lock state is CHECKPOINT,
|
||||
** the mutex is not acquired because CHECKPOINT will never remap the
|
||||
** buffer. RECOVER might remap, though, so CHECKPOINT will acquire
|
||||
** the mutex if and when it promotes to RECOVER.
|
||||
**
|
||||
** RECOVER needs to be atomic. The same mutex that prevents *ppBuf from
|
||||
** being remapped also prevents more than one thread from being in
|
||||
** RECOVER at a time. But, RECOVER sometimes wants to remap itself.
|
||||
** To prevent RECOVER from losing its lock while remapping, the
|
||||
** mutex is not released by unixShmRelease() when in RECOVER.
|
||||
**
|
||||
** *pNewMapSize is set to the size of the mapping. Usually *pNewMapSize
|
||||
** will be reqMapSize or larger, though it could be smaller if the
|
||||
** underlying shared memory has never been enlarged to reqMapSize bytes
|
||||
** by prior calls to xShmSize().
|
||||
**
|
||||
** *ppBuf might be NULL and zero if no space has
|
||||
** yet been allocated to the underlying storage.
|
||||
*/
|
||||
static int unixShmGet(
|
||||
sqlite3_file *fd, /* Database file holding shared memory */
|
||||
int reqMapSize, /* Requested size of mapping. -1 means don't care */
|
||||
int *pNewMapSize, /* Write new size of mapping here */
|
||||
void volatile **ppBuf /* Write mapping buffer origin here */
|
||||
){
|
||||
unixFile *pDbFd = (unixFile*)fd;
|
||||
unixShm *p = pDbFd->pShm;
|
||||
unixShmNode *pShmNode = p->pShmNode;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
assert( pShmNode==pDbFd->pInode->pShmNode );
|
||||
assert( pShmNode->pInode==pDbFd->pInode );
|
||||
|
||||
if( p->hasMutexBuf==0 ){
|
||||
assert( sqlite3_mutex_notheld(pShmNode->mutex) );
|
||||
sqlite3_mutex_enter(pShmNode->mutexBuf);
|
||||
p->hasMutexBuf = 1;
|
||||
}
|
||||
sqlite3_mutex_enter(pShmNode->mutex);
|
||||
if( pShmNode->szMap==0 || reqMapSize>pShmNode->szMap ){
|
||||
int actualSize;
|
||||
if( unixShmSize(fd, -1, &actualSize)!=SQLITE_OK ){
|
||||
actualSize = 0;
|
||||
}
|
||||
reqMapSize = actualSize;
|
||||
if( pShmNode->pMMapBuf || reqMapSize<=0 ){
|
||||
munmap(pShmNode->pMMapBuf, pShmNode->szMap);
|
||||
}
|
||||
if( reqMapSize>0 ){
|
||||
pShmNode->pMMapBuf = mmap(0, reqMapSize, PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||
pShmNode->h, 0);
|
||||
pShmNode->szMap = pShmNode->pMMapBuf ? reqMapSize : 0;
|
||||
}else{
|
||||
pShmNode->pMMapBuf = 0;
|
||||
pShmNode->szMap = 0;
|
||||
}
|
||||
}
|
||||
*pNewMapSize = pShmNode->szMap;
|
||||
*ppBuf = pShmNode->pMMapBuf;
|
||||
sqlite3_mutex_leave(pShmNode->mutex);
|
||||
if( *ppBuf==0 ){
|
||||
/* Do not hold the mutex if a NULL pointer is being returned. */
|
||||
unixShmRelease(fd);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Change the lock state for a shared-memory segment.
|
||||
**
|
||||
@@ -3711,16 +3548,35 @@ static int unixShmLock(
|
||||
** any load or store begun after the barrier.
|
||||
*/
|
||||
static void unixShmBarrier(
|
||||
sqlite3_file *fd /* Database file holding the shared memory */
|
||||
sqlite3_file *fd /* Database file holding the shared memory */
|
||||
){
|
||||
unixEnterMutex();
|
||||
unixLeaveMutex();
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is called to obtain a pointer to region iRegion of the
|
||||
** shared-memory associated with the database file fd. Shared-memory regions
|
||||
** are numbered starting from zero. Each shared-memory region is szRegion
|
||||
** bytes in size.
|
||||
**
|
||||
** If an error occurs, an error code is returned and *pp is set to NULL.
|
||||
**
|
||||
** Otherwise, if the isWrite parameter is 0 and the requested shared-memory
|
||||
** region has not been allocated (by any client, including one running in a
|
||||
** separate process), then *pp is set to NULL and SQLITE_OK returned. If
|
||||
** isWrite is non-zero and the requested shared-memory region has not yet
|
||||
** been allocated, it is allocated by this function.
|
||||
**
|
||||
** If the shared-memory region has already been allocated or is allocated by
|
||||
** this call as described above, then it is mapped into this processes
|
||||
** address space (if it is not already), *pp is set to point to the mapped
|
||||
** memory and SQLITE_OK returned.
|
||||
*/
|
||||
static int unixShmPage(
|
||||
sqlite3_file *fd, /* Handle open on database file */
|
||||
int iPage, /* Page to retrieve */
|
||||
int pgsz, /* Size of pages */
|
||||
int iRegion, /* Region to retrieve */
|
||||
int szRegion, /* Size of regions */
|
||||
int isWrite, /* True to extend file if necessary */
|
||||
void volatile **pp /* OUT: Mapped memory */
|
||||
){
|
||||
@@ -3729,22 +3585,32 @@ static int unixShmPage(
|
||||
unixShmNode *pShmNode = p->pShmNode;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
assert( p->hasMutexBuf==0 );
|
||||
sqlite3_mutex_enter(pShmNode->mutexBuf);
|
||||
assert( pgsz==pShmNode->pgsz || pShmNode->nPage==0 );
|
||||
sqlite3_mutex_enter(pShmNode->mutex);
|
||||
assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );
|
||||
|
||||
if( pShmNode->nPage<=iPage ){
|
||||
char **apNew; /* New apPage[] array */
|
||||
int nByte = (iPage+1)*pgsz; /* Minimum required file size */
|
||||
struct stat sStat;
|
||||
if( pShmNode->nRegion<=iRegion ){
|
||||
char **apNew; /* New apRegion[] array */
|
||||
int nByte = (iRegion+1)*szRegion; /* Minimum required file size */
|
||||
struct stat sStat; /* Used by fstat() */
|
||||
|
||||
pShmNode->pgsz = pgsz;
|
||||
pShmNode->szRegion = szRegion;
|
||||
|
||||
/* Make sure the underlying file is large enough (or fail) */
|
||||
/* The requested region is not mapped into this processes address space.
|
||||
** Check to see if it has been allocated (i.e. if the wal-index file is
|
||||
** large enough to contain the requested region).
|
||||
*/
|
||||
if( fstat(pShmNode->h, &sStat) ){
|
||||
rc = SQLITE_IOERR_SHMSIZE;
|
||||
goto shmpage_out;
|
||||
}else if( sStat.st_size<nByte ){
|
||||
}
|
||||
|
||||
if( sStat.st_size<nByte ){
|
||||
/* The requested memory region does not exist. If isWrite is set to
|
||||
** zero, exit early. *pp will be set to NULL and SQLITE_OK returned.
|
||||
**
|
||||
** Alternatively, if isWrite is non-zero, use ftruncate() to allocate
|
||||
** the requested memory region.
|
||||
*/
|
||||
if( !isWrite ) goto shmpage_out;
|
||||
if( ftruncate(pShmNode->h, nByte) ){
|
||||
rc = SQLITE_IOERR_SHMSIZE;
|
||||
@@ -3752,42 +3618,40 @@ static int unixShmPage(
|
||||
}
|
||||
}
|
||||
|
||||
apNew = (char**)sqlite3_realloc(pShmNode->apPage, (iPage+1)*sizeof(char *));
|
||||
/* Map the requested memory region into this processes address space. */
|
||||
apNew = (char **)sqlite3_realloc(
|
||||
pShmNode->apRegion, (iRegion+1)*sizeof(char *)
|
||||
);
|
||||
if( !apNew ){
|
||||
rc = SQLITE_IOERR_NOMEM;
|
||||
goto shmpage_out;
|
||||
}
|
||||
pShmNode->apPage = apNew;
|
||||
|
||||
while(pShmNode->nPage<=iPage){
|
||||
void *pMem = mmap(
|
||||
0, pgsz, PROT_READ|PROT_WRITE, MAP_SHARED, pShmNode->h, iPage*pgsz
|
||||
pShmNode->apRegion = apNew;
|
||||
while(pShmNode->nRegion<=iRegion){
|
||||
void *pMem = mmap(0, szRegion, PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED, pShmNode->h, iRegion*szRegion
|
||||
);
|
||||
if( pMem==MAP_FAILED ){
|
||||
assert(0);
|
||||
rc = SQLITE_IOERR;
|
||||
goto shmpage_out;
|
||||
}
|
||||
pShmNode->apPage[pShmNode->nPage] = pMem;
|
||||
pShmNode->nPage++;
|
||||
pShmNode->apRegion[pShmNode->nRegion] = pMem;
|
||||
pShmNode->nRegion++;
|
||||
}
|
||||
}
|
||||
|
||||
shmpage_out:
|
||||
if( pShmNode->nPage>iPage ){
|
||||
*pp = pShmNode->apPage[iPage];
|
||||
if( pShmNode->nRegion>iRegion ){
|
||||
*pp = pShmNode->apRegion[iRegion];
|
||||
}else{
|
||||
*pp = 0;
|
||||
}
|
||||
sqlite3_mutex_leave(pShmNode->mutexBuf);
|
||||
sqlite3_mutex_leave(pShmNode->mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#else
|
||||
# define unixShmOpen 0
|
||||
# define unixShmSize 0
|
||||
# define unixShmGet 0
|
||||
# define unixShmRelease 0
|
||||
# define unixShmLock 0
|
||||
# define unixShmBarrier 0
|
||||
# define unixShmClose 0
|
||||
@@ -3850,9 +3714,6 @@ static const sqlite3_io_methods METHOD = { \
|
||||
unixSectorSize, /* xSectorSize */ \
|
||||
unixDeviceCharacteristics, /* xDeviceCapabilities */ \
|
||||
unixShmOpen, /* xShmOpen */ \
|
||||
unixShmSize, /* xShmSize */ \
|
||||
unixShmGet, /* xShmGet */ \
|
||||
unixShmRelease, /* xShmRelease */ \
|
||||
unixShmLock, /* xShmLock */ \
|
||||
unixShmBarrier, /* xShmBarrier */ \
|
||||
unixShmClose, /* xShmClose */ \
|
||||
|
@@ -660,13 +660,10 @@ struct sqlite3_io_methods {
|
||||
int (*xDeviceCharacteristics)(sqlite3_file*);
|
||||
/* Methods above are valid for version 1 */
|
||||
int (*xShmOpen)(sqlite3_file*);
|
||||
int (*xShmSize)(sqlite3_file*, int reqSize, int *pNewSize);
|
||||
int (*xShmGet)(sqlite3_file*, int reqSize, int *pSize, void volatile**);
|
||||
int (*xShmRelease)(sqlite3_file*);
|
||||
int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
|
||||
void (*xShmBarrier)(sqlite3_file*);
|
||||
int (*xShmClose)(sqlite3_file*, int deleteFlag);
|
||||
int (*xShmPage)(sqlite3_file*, int iPage, int pgsz, int, void volatile**);
|
||||
int (*xShmMap)(sqlite3_file*, int iPage, int pgsz, int, void volatile**);
|
||||
/* Methods above are valid for version 2 */
|
||||
/* Additional methods may be added in future releases */
|
||||
};
|
||||
|
28
src/test6.c
28
src/test6.c
@@ -526,20 +526,6 @@ static int cfDeviceCharacteristics(sqlite3_file *pFile){
|
||||
static int cfShmOpen(sqlite3_file *pFile){
|
||||
return sqlite3OsShmOpen(((CrashFile*)pFile)->pRealFile);
|
||||
}
|
||||
static int cfShmSize(sqlite3_file *pFile, int reqSize, int *pNew){
|
||||
return sqlite3OsShmSize(((CrashFile*)pFile)->pRealFile, reqSize, pNew);
|
||||
}
|
||||
static int cfShmGet(
|
||||
sqlite3_file *pFile,
|
||||
int reqSize,
|
||||
int *pSize,
|
||||
void volatile **pp
|
||||
){
|
||||
return sqlite3OsShmGet(((CrashFile*)pFile)->pRealFile, reqSize, pSize, pp);
|
||||
}
|
||||
static int cfShmRelease(sqlite3_file *pFile){
|
||||
return sqlite3OsShmRelease(((CrashFile*)pFile)->pRealFile);
|
||||
}
|
||||
static int cfShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
|
||||
return sqlite3OsShmLock(((CrashFile*)pFile)->pRealFile, ofst, n, flags);
|
||||
}
|
||||
@@ -549,17 +535,16 @@ static void cfShmBarrier(sqlite3_file *pFile){
|
||||
static int cfShmClose(sqlite3_file *pFile, int delFlag){
|
||||
return sqlite3OsShmClose(((CrashFile*)pFile)->pRealFile, delFlag);
|
||||
}
|
||||
static int cfShmPage(
|
||||
static int cfShmMap(
|
||||
sqlite3_file *pFile, /* Handle open on database file */
|
||||
int iPage, /* Page to retrieve */
|
||||
int pgsz, /* Size of pages */
|
||||
int iRegion, /* Region to retrieve */
|
||||
int sz, /* Size of regions */
|
||||
int w, /* True to extend file if necessary */
|
||||
void volatile **pp /* OUT: Mapped memory */
|
||||
){
|
||||
return sqlite3OsShmPage(((CrashFile*)pFile)->pRealFile, iPage, pgsz, w, pp);
|
||||
return sqlite3OsShmMap(((CrashFile*)pFile)->pRealFile, iRegion, sz, w, pp);
|
||||
}
|
||||
|
||||
|
||||
static const sqlite3_io_methods CrashFileVtab = {
|
||||
2, /* iVersion */
|
||||
cfClose, /* xClose */
|
||||
@@ -575,13 +560,10 @@ static const sqlite3_io_methods CrashFileVtab = {
|
||||
cfSectorSize, /* xSectorSize */
|
||||
cfDeviceCharacteristics, /* xDeviceCharacteristics */
|
||||
cfShmOpen, /* xShmOpen */
|
||||
cfShmSize, /* xShmSize */
|
||||
cfShmGet, /* xShmGet */
|
||||
cfShmRelease, /* xShmRelease */
|
||||
cfShmLock, /* xShmLock */
|
||||
cfShmBarrier, /* xShmBarrier */
|
||||
cfShmClose, /* xShmClose */
|
||||
cfShmPage /* xShmPage */
|
||||
cfShmMap /* xShmMap */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -51,13 +51,10 @@ static int devsymFileControl(sqlite3_file*, int op, void *pArg);
|
||||
static int devsymSectorSize(sqlite3_file*);
|
||||
static int devsymDeviceCharacteristics(sqlite3_file*);
|
||||
static int devsymShmOpen(sqlite3_file*);
|
||||
static int devsymShmSize(sqlite3_file*,int,int*);
|
||||
static int devsymShmGet(sqlite3_file*,int,int*,volatile void**);
|
||||
static int devsymShmRelease(sqlite3_file*);
|
||||
static int devsymShmLock(sqlite3_file*,int,int,int);
|
||||
static void devsymShmBarrier(sqlite3_file*);
|
||||
static int devsymShmClose(sqlite3_file*,int);
|
||||
static int devsymShmPage(sqlite3_file*,int,int,int, void volatile **);
|
||||
static int devsymShmMap(sqlite3_file*,int,int,int, void volatile **);
|
||||
|
||||
/*
|
||||
** Method declarations for devsym_vfs.
|
||||
@@ -121,13 +118,10 @@ static sqlite3_io_methods devsym_io_methods = {
|
||||
devsymSectorSize, /* xSectorSize */
|
||||
devsymDeviceCharacteristics, /* xDeviceCharacteristics */
|
||||
devsymShmOpen, /* xShmOpen */
|
||||
devsymShmSize, /* xShmSize */
|
||||
devsymShmGet, /* xShmGet */
|
||||
devsymShmRelease, /* xShmRelease */
|
||||
devsymShmLock, /* xShmLock */
|
||||
devsymShmBarrier, /* xShmBarrier */
|
||||
devsymShmClose, /* xShmClose */
|
||||
devsymShmPage /* xShmPage */
|
||||
devsymShmMap /* xShmMap */
|
||||
};
|
||||
|
||||
struct DevsymGlobal {
|
||||
@@ -248,23 +242,6 @@ static int devsymShmOpen(sqlite3_file *pFile){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmOpen(p->pReal);
|
||||
}
|
||||
static int devsymShmSize(sqlite3_file *pFile, int reqSize, int *pSize){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmSize(p->pReal, reqSize, pSize);
|
||||
}
|
||||
static int devsymShmGet(
|
||||
sqlite3_file *pFile,
|
||||
int reqSz,
|
||||
int *pSize,
|
||||
void volatile **pp
|
||||
){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmGet(p->pReal, reqSz, pSize, pp);
|
||||
}
|
||||
static int devsymShmRelease(sqlite3_file *pFile){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmRelease(p->pReal);
|
||||
}
|
||||
static int devsymShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmLock(p->pReal, ofst, n, flags);
|
||||
@@ -277,15 +254,15 @@ static int devsymShmClose(sqlite3_file *pFile, int delFlag){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmClose(p->pReal, delFlag);
|
||||
}
|
||||
static int devsymShmPage(
|
||||
static int devsymShmMap(
|
||||
sqlite3_file *pFile,
|
||||
int iPage,
|
||||
int pgsz,
|
||||
int iRegion,
|
||||
int szRegion,
|
||||
int isWrite,
|
||||
void volatile **pp
|
||||
){
|
||||
devsym_file *p = (devsym_file *)pFile;
|
||||
return sqlite3OsShmPage(p->pReal, iPage, pgsz, isWrite, pp);
|
||||
return sqlite3OsShmMap(p->pReal, iRegion, szRegion, isWrite, pp);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -100,11 +100,9 @@
|
||||
#define OS_WRITE 20
|
||||
#define OS_SHMOPEN 21
|
||||
#define OS_SHMCLOSE 22
|
||||
#define OS_SHMGET 23
|
||||
#define OS_SHMRELEASE 24
|
||||
#define OS_SHMMAP 23
|
||||
#define OS_SHMLOCK 25
|
||||
#define OS_SHMBARRIER 26
|
||||
#define OS_SHMSIZE 27
|
||||
#define OS_ANNOTATE 28
|
||||
|
||||
#define OS_NUMEVENTS 29
|
||||
@@ -152,12 +150,10 @@ static int vfslogSectorSize(sqlite3_file*);
|
||||
static int vfslogDeviceCharacteristics(sqlite3_file*);
|
||||
|
||||
static int vfslogShmOpen(sqlite3_file *pFile);
|
||||
static int vfslogShmSize(sqlite3_file *pFile, int reqSize, int *pNewSize);
|
||||
static int vfslogShmGet(sqlite3_file *pFile, int,int*,volatile void **);
|
||||
static int vfslogShmRelease(sqlite3_file *pFile);
|
||||
static int vfslogShmLock(sqlite3_file *pFile, int ofst, int n, int flags);
|
||||
static void vfslogShmBarrier(sqlite3_file*);
|
||||
static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag);
|
||||
static int vfslogShmMap(sqlite3_file *pFile,int,int,int,volatile void **);
|
||||
|
||||
/*
|
||||
** Method declarations for vfslog_vfs.
|
||||
@@ -216,12 +212,10 @@ static sqlite3_io_methods vfslog_io_methods = {
|
||||
vfslogSectorSize, /* xSectorSize */
|
||||
vfslogDeviceCharacteristics, /* xDeviceCharacteristics */
|
||||
vfslogShmOpen, /* xShmOpen */
|
||||
vfslogShmSize, /* xShmSize */
|
||||
vfslogShmGet, /* xShmGet */
|
||||
vfslogShmRelease, /* xShmRelease */
|
||||
vfslogShmLock, /* xShmLock */
|
||||
vfslogShmBarrier, /* xShmBarrier */
|
||||
vfslogShmClose /* xShmClose */
|
||||
vfslogShmClose, /* xShmClose */
|
||||
vfslogShmMap /* xShmMap */
|
||||
};
|
||||
|
||||
#if defined(SQLITE_OS_UNIX) && !defined(NO_GETTOD)
|
||||
@@ -441,41 +435,6 @@ static int vfslogShmOpen(sqlite3_file *pFile){
|
||||
vfslog_call(p->pVfslog, OS_SHMOPEN, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
static int vfslogShmSize(sqlite3_file *pFile, int reqSize, int *pNewSize){
|
||||
int rc;
|
||||
sqlite3_uint64 t;
|
||||
VfslogFile *p = (VfslogFile *)pFile;
|
||||
t = vfslog_time();
|
||||
rc = p->pReal->pMethods->xShmSize(p->pReal, reqSize, pNewSize);
|
||||
t = vfslog_time() - t;
|
||||
vfslog_call(p->pVfslog, OS_SHMSIZE, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
static int vfslogShmGet(
|
||||
sqlite3_file *pFile,
|
||||
int req,
|
||||
int *pSize,
|
||||
volatile void **pp
|
||||
){
|
||||
int rc;
|
||||
sqlite3_uint64 t;
|
||||
VfslogFile *p = (VfslogFile *)pFile;
|
||||
t = vfslog_time();
|
||||
rc = p->pReal->pMethods->xShmGet(p->pReal, req, pSize, pp);
|
||||
t = vfslog_time() - t;
|
||||
vfslog_call(p->pVfslog, OS_SHMGET, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
static int vfslogShmRelease(sqlite3_file *pFile){
|
||||
int rc;
|
||||
sqlite3_uint64 t;
|
||||
VfslogFile *p = (VfslogFile *)pFile;
|
||||
t = vfslog_time();
|
||||
rc = p->pReal->pMethods->xShmRelease(p->pReal);
|
||||
t = vfslog_time() - t;
|
||||
vfslog_call(p->pVfslog, OS_SHMRELEASE, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
static int vfslogShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
|
||||
int rc;
|
||||
sqlite3_uint64 t;
|
||||
@@ -504,6 +463,22 @@ static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag){
|
||||
vfslog_call(p->pVfslog, OS_SHMCLOSE, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
static int vfslogShmMap(
|
||||
sqlite3_file *pFile,
|
||||
int iRegion,
|
||||
int szRegion,
|
||||
int isWrite,
|
||||
volatile void **pp
|
||||
){
|
||||
int rc;
|
||||
sqlite3_uint64 t;
|
||||
VfslogFile *p = (VfslogFile *)pFile;
|
||||
t = vfslog_time();
|
||||
rc = p->pReal->pMethods->xShmMap(p->pReal, iRegion, szRegion, isWrite, pp);
|
||||
t = vfslog_time() - t;
|
||||
vfslog_call(p->pVfslog, OS_SHMMAP, p->iFileId, t, rc, 0, 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -826,11 +801,9 @@ static const char *vfslog_eventname(int eEvent){
|
||||
|
||||
case OS_SHMCLOSE: zEvent = "xShmClose"; break;
|
||||
case OS_SHMOPEN: zEvent = "xShmOpen"; break;
|
||||
case OS_SHMGET: zEvent = "xShmGet"; break;
|
||||
case OS_SHMSIZE: zEvent = "xShmSize"; break;
|
||||
case OS_SHMRELEASE: zEvent = "xShmRelease"; break;
|
||||
case OS_SHMLOCK: zEvent = "xShmLock"; break;
|
||||
case OS_SHMBARRIER: zEvent = "xShmBarrier"; break;
|
||||
case OS_SHMMAP: zEvent = "xShmMap"; break;
|
||||
|
||||
case OS_ANNOTATE: zEvent = "annotation"; break;
|
||||
}
|
||||
|
@@ -69,9 +69,6 @@ struct Testvfs {
|
||||
** + Invoking the Tcl callback script.
|
||||
*/
|
||||
#define TESTVFS_SHMOPEN_MASK 0x00000001
|
||||
#define TESTVFS_SHMSIZE_MASK 0x00000002
|
||||
#define TESTVFS_SHMGET_MASK 0x00000004
|
||||
#define TESTVFS_SHMRELEASE_MASK 0x00000008
|
||||
#define TESTVFS_SHMLOCK_MASK 0x00000010
|
||||
#define TESTVFS_SHMBARRIER_MASK 0x00000020
|
||||
#define TESTVFS_SHMCLOSE_MASK 0x00000040
|
||||
@@ -137,9 +134,6 @@ static int tvfsSleep(sqlite3_vfs*, int microseconds);
|
||||
static int tvfsCurrentTime(sqlite3_vfs*, double*);
|
||||
|
||||
static int tvfsShmOpen(sqlite3_file*);
|
||||
static int tvfsShmSize(sqlite3_file*, int , int *);
|
||||
static int tvfsShmGet(sqlite3_file*, int , int *, volatile void **);
|
||||
static int tvfsShmRelease(sqlite3_file*);
|
||||
static int tvfsShmLock(sqlite3_file*, int , int, int);
|
||||
static void tvfsShmBarrier(sqlite3_file*);
|
||||
static int tvfsShmClose(sqlite3_file*, int);
|
||||
@@ -160,9 +154,6 @@ static sqlite3_io_methods tvfs_io_methods = {
|
||||
tvfsSectorSize, /* xSectorSize */
|
||||
tvfsDeviceCharacteristics, /* xDeviceCharacteristics */
|
||||
tvfsShmOpen, /* xShmOpen */
|
||||
tvfsShmSize, /* xShmSize */
|
||||
tvfsShmGet, /* xShmGet */
|
||||
tvfsShmRelease, /* xShmRelease */
|
||||
tvfsShmLock, /* xShmLock */
|
||||
tvfsShmBarrier, /* xShmBarrier */
|
||||
tvfsShmClose, /* xShmClose */
|
||||
@@ -449,12 +440,10 @@ static int tvfsOpen(
|
||||
memcpy(pMethods, &tvfs_io_methods, sizeof(sqlite3_io_methods));
|
||||
if( ((Testvfs *)pVfs->pAppData)->isNoshm ){
|
||||
pMethods->xShmOpen = 0;
|
||||
pMethods->xShmGet = 0;
|
||||
pMethods->xShmSize = 0;
|
||||
pMethods->xShmRelease = 0;
|
||||
pMethods->xShmClose = 0;
|
||||
pMethods->xShmLock = 0;
|
||||
pMethods->xShmBarrier = 0;
|
||||
pMethods->xShmMap = 0;
|
||||
}
|
||||
pFile->pMethods = pMethods;
|
||||
}
|
||||
@@ -615,28 +604,6 @@ static int tvfsShmOpen(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
static int tvfsShmSize(
|
||||
sqlite3_file *pFile,
|
||||
int reqSize,
|
||||
int *pNewSize
|
||||
){
|
||||
assert(0);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
static int tvfsShmGet(
|
||||
sqlite3_file *pFile,
|
||||
int reqMapSize,
|
||||
int *pMapSize,
|
||||
volatile void **pp
|
||||
){
|
||||
assert(0);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
static int tvfsShmRelease(sqlite3_file *pFile){
|
||||
assert(0);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
static void tvfsAllocPage(TestvfsBuffer *p, int iPage, int pgsz){
|
||||
assert( iPage<TESTVFS_MAX_PAGES );
|
||||
if( p->aPage[iPage]==0 ){
|
||||
@@ -871,9 +838,6 @@ static int testvfs_obj_cmd(
|
||||
int mask;
|
||||
} vfsmethod [] = {
|
||||
{ "xShmOpen", TESTVFS_SHMOPEN_MASK },
|
||||
{ "xShmSize", TESTVFS_SHMSIZE_MASK },
|
||||
{ "xShmGet", TESTVFS_SHMGET_MASK },
|
||||
{ "xShmRelease", TESTVFS_SHMRELEASE_MASK },
|
||||
{ "xShmLock", TESTVFS_SHMLOCK_MASK },
|
||||
{ "xShmBarrier", TESTVFS_SHMBARRIER_MASK },
|
||||
{ "xShmClose", TESTVFS_SHMCLOSE_MASK },
|
||||
|
@@ -483,7 +483,7 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
|
||||
|
||||
/* Request a pointer to the required page from the VFS */
|
||||
if( pWal->apWiData[iPage]==0 ){
|
||||
rc = sqlite3OsShmPage(pWal->pDbFd, iPage, WALINDEX_PGSZ,
|
||||
rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ,
|
||||
pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user