mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
More updates to the Win32 interface for lsm1.
FossilOrigin-Name: cae647696769c9fcdc3beafdfdf74d8384217f4b22820e4545093bea7be58f7c
This commit is contained in:
@@ -38,6 +38,7 @@ struct Win32File {
|
|||||||
HANDLE hFile; /* Open file handle */
|
HANDLE hFile; /* Open file handle */
|
||||||
HANDLE hShmFile; /* File handle for *-shm file */
|
HANDLE hShmFile; /* File handle for *-shm file */
|
||||||
|
|
||||||
|
SYSTEM_INFO sysInfo; /* Operating system information */
|
||||||
HANDLE hMap; /* File handle for mapping */
|
HANDLE hMap; /* File handle for mapping */
|
||||||
LPVOID pMap; /* Pointer to mapping of file fd */
|
LPVOID pMap; /* Pointer to mapping of file fd */
|
||||||
size_t nMap; /* Size of mapping at pMap in bytes */
|
size_t nMap; /* Size of mapping at pMap in bytes */
|
||||||
@@ -256,6 +257,8 @@ static int lsmWin32OsOpen(
|
|||||||
|
|
||||||
rc = win32Open(pEnv, zFile, flags, &hFile);
|
rc = win32Open(pEnv, zFile, flags, &hFile);
|
||||||
if( rc==LSM_OK ){
|
if( rc==LSM_OK ){
|
||||||
|
memset(&pWin32File->sysInfo, 0, sizeof(SYSTEM_INFO));
|
||||||
|
GetSystemInfo(&pWin32File->sysInfo);
|
||||||
pWin32File->pEnv = pEnv;
|
pWin32File->pEnv = pEnv;
|
||||||
pWin32File->zName = zFile;
|
pWin32File->zName = zFile;
|
||||||
pWin32File->hFile = hFile;
|
pWin32File->hFile = hFile;
|
||||||
@@ -367,6 +370,7 @@ static int lsmWin32OsSync(lsm_file *pFile){
|
|||||||
rc = LSM_IOERR_BKPT;
|
rc = LSM_IOERR_BKPT;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
unused_parameter(pFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -673,11 +677,11 @@ int lsmWin32OsShmMap(lsm_file *pFile, int iChunk, int sz, void **ppShm){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ahNew = (void **)lsmRealloc(pWin32File->pEnv, pWin32File->ahShm,
|
ahNew = (LPHANDLE)lsmRealloc(pWin32File->pEnv, pWin32File->ahShm,
|
||||||
sizeof(LPHANDLE) * nNew);
|
sizeof(LPHANDLE) * nNew);
|
||||||
if( !ahNew ) return LSM_NOMEM_BKPT;
|
if( !ahNew ) return LSM_NOMEM_BKPT;
|
||||||
apNew = (void **)lsmRealloc(pWin32File->pEnv, pWin32File->apShm,
|
apNew = (LPVOID *)lsmRealloc(pWin32File->pEnv, pWin32File->apShm,
|
||||||
sizeof(LPVOID) * nNew);
|
sizeof(LPVOID) * nNew);
|
||||||
if( !apNew ){
|
if( !apNew ){
|
||||||
lsmFree(pWin32File->pEnv, ahNew);
|
lsmFree(pWin32File->pEnv, ahNew);
|
||||||
return LSM_NOMEM_BKPT;
|
return LSM_NOMEM_BKPT;
|
||||||
@@ -701,10 +705,12 @@ int lsmWin32OsShmMap(lsm_file *pFile, int iChunk, int sz, void **ppShm){
|
|||||||
pWin32File->ahShm[iChunk] = hMap;
|
pWin32File->ahShm[iChunk] = hMap;
|
||||||
}
|
}
|
||||||
if( pWin32File->apShm[iChunk]==NULL ){
|
if( pWin32File->apShm[iChunk]==NULL ){
|
||||||
|
int iOffset = iChunk * sz;
|
||||||
|
int iOffsetShift = iOffset % pWin32File->sysInfo.dwAllocationGranularity;
|
||||||
LPVOID pMap;
|
LPVOID pMap;
|
||||||
pMap = MapViewOfFile(pWin32File->ahShm[iChunk],
|
pMap = MapViewOfFile(pWin32File->ahShm[iChunk],
|
||||||
FILE_MAP_WRITE | FILE_MAP_READ, 0, (DWORD)(iChunk*sz),
|
FILE_MAP_WRITE | FILE_MAP_READ, 0,
|
||||||
(SIZE_T)sz);
|
iOffset - iOffsetShift, sz + iOffsetShift);
|
||||||
if( pMap==NULL ){
|
if( pMap==NULL ){
|
||||||
return LSM_IOERR_BKPT;
|
return LSM_IOERR_BKPT;
|
||||||
}
|
}
|
||||||
@@ -734,7 +740,7 @@ int lsmWin32OsShmUnmap(lsm_file *pFile, int bDelete){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CloseHandle(pWin32File->hShmFile);
|
CloseHandle(pWin32File->hShmFile);
|
||||||
pWin32File->hShmFile = 0;
|
pWin32File->hShmFile = NULL;
|
||||||
if( bDelete ){
|
if( bDelete ){
|
||||||
char *zShm = win32ShmFile(pWin32File);
|
char *zShm = win32ShmFile(pWin32File);
|
||||||
if( zShm ){ win32Delete(pWin32File->pEnv, zShm); }
|
if( zShm ){ win32Delete(pWin32File->pEnv, zShm); }
|
||||||
|
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Correct\stypo\sin\sthe\sWin32\sinterface\sfor\slsm1.
|
C More\supdates\sto\sthe\sWin32\sinterface\sfor\slsm1.
|
||||||
D 2017-06-29T15:57:42.733
|
D 2017-06-29T16:51:52.526
|
||||||
F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12
|
F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc 4ebb1d257cac7fb1bcb4ba59278416d410ff1c4bf59447a9c37a415f3516056a
|
F Makefile.msc 4ebb1d257cac7fb1bcb4ba59278416d410ff1c4bf59447a9c37a415f3516056a
|
||||||
@@ -250,7 +250,7 @@ F ext/lsm1/lsm_tree.c 5d9fb2bc58a1a70c75126bd8d7198f7b627e165b
|
|||||||
F ext/lsm1/lsm_unix.c ee0201dff10ce2008ef13a65f52a6ea348f287e795270f651596f812fcfccdcc
|
F ext/lsm1/lsm_unix.c ee0201dff10ce2008ef13a65f52a6ea348f287e795270f651596f812fcfccdcc
|
||||||
F ext/lsm1/lsm_varint.c b19ae9bd26b5a1e8402fb8a564b25d9542338a41
|
F ext/lsm1/lsm_varint.c b19ae9bd26b5a1e8402fb8a564b25d9542338a41
|
||||||
F ext/lsm1/lsm_vtab.c fff303ce03168eca9e333add3c1429b3471674b0
|
F ext/lsm1/lsm_vtab.c fff303ce03168eca9e333add3c1429b3471674b0
|
||||||
F ext/lsm1/lsm_win32.c a8778d33353fe1bc2c36ca55b66a44bd622a81132e29ff757ec356a9e612918d
|
F ext/lsm1/lsm_win32.c 29b76829d29921e1f2297d8400c37ffed23479e2a519a9421bf2467c9bfceea3
|
||||||
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
|
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
|
||||||
F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87
|
F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87
|
||||||
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
||||||
@@ -1627,7 +1627,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 03977248e6fdaa9b35c15e5dd9bb89552f2f0a913cc31609b5af1e2347b67d38
|
P 1b4facb1ad0085aa52e63d4d432179467ddc2a69b668d49d86e65ead66a73f57
|
||||||
R 79b84f9a8519664e4d7f0ed69702a134
|
R 54d1afcb2229149b45247539ffd292a9
|
||||||
U mistachkin
|
U mistachkin
|
||||||
Z fcbc14d99bbb3aa5af7edd91ba2de7eb
|
Z bb74ca7ad985e0783b7fe8f258278d9c
|
||||||
|
@@ -1 +1 @@
|
|||||||
1b4facb1ad0085aa52e63d4d432179467ddc2a69b668d49d86e65ead66a73f57
|
cae647696769c9fcdc3beafdfdf74d8384217f4b22820e4545093bea7be58f7c
|
Reference in New Issue
Block a user