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

Add munmap and mremap to the set of os interfaces that can be overloaded

in os_unix.c.

FossilOrigin-Name: 8776047bd776bbf266eb9c3b56683badb84ae73e
This commit is contained in:
drh
2013-03-25 20:50:25 +00:00
parent b7e3a326fe
commit d1ab8065c1
4 changed files with 25 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Use\smremap()\son\sLinux. C Add\smunmap\sand\smremap\sto\sthe\sset\sof\sos\sinterfaces\sthat\scan\sbe\soverloaded\nin\sos_unix.c.
D 2013-03-25T20:30:13.313 D 2013-03-25T20:50:25.204
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7 F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -160,7 +160,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d
F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4 F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c a4d7076a6edd4e6a8594191880e540a31b2c8598 F src/os_unix.c 6b3f972a8b515ce151d1d075080b10d52adbfbd6
F src/os_win.c e4f17ddf79f2a9373e33ed70565e765d65324589 F src/os_win.c e4f17ddf79f2a9373e33ed70565e765d65324589
F src/pager.c 4e1b55e7a50db0466b06f8ec114799b432c18131 F src/pager.c 4e1b55e7a50db0466b06f8ec114799b432c18131
F src/pager.h 241d72dc0905df042da165f086d03505cb0bb50c F src/pager.h 241d72dc0905df042da165f086d03505cb0bb50c
@@ -747,7 +747,7 @@ F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
F test/superlock.test 1cde669f68d2dd37d6c9bd35eee1d95491ae3fc2 F test/superlock.test 1cde669f68d2dd37d6c9bd35eee1d95491ae3fc2
F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
F test/syscall.test cf59bafccb143f8df21c043b3201d5afa9fe2474 F test/syscall.test a653783d985108c4912cc64d341ffbbb55ad2806
F test/sysfault.test 3258d6c8213b44f2669994d798a5eb5327b40146 F test/sysfault.test 3258d6c8213b44f2669994d798a5eb5327b40146
F test/table.test a59d985ca366e39b17b175f387f9d5db5a18d4e2 F test/table.test a59d985ca366e39b17b175f387f9d5db5a18d4e2
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
@@ -1040,7 +1040,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P a607d63f0b6a3d3785e9385187d3e6b92e14fc70 P 431aecc8600c29c203546e48d256510510238887
R 18e19b2d7d709a7b2b83b278bfc05f98 R 420b4ff666854b5074068c14722ea276
U dan U drh
Z f03c297d3465d1cb9dc069838022accc Z feb03effee9a1e5215de46a6338d0c52

View File

@@ -1 +1 @@
431aecc8600c29c203546e48d256510510238887 8776047bd776bbf266eb9c3b56683badb84ae73e

View File

@@ -447,6 +447,16 @@ static struct unix_syscall {
{ "mmap", (sqlite3_syscall_ptr)mmap, 0 }, { "mmap", (sqlite3_syscall_ptr)mmap, 0 },
#define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[21].pCurrent) #define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[21].pCurrent)
{ "munmap", (sqlite3_syscall_ptr)munmap, 0 },
#define osMunmap ((void*(*)(void*,size_t))aSyscall[22].pCurrent)
#if defined(__linux__) && defined(_GNU_SOURCE)
{ "mremap", (sqlite3_syscall_ptr)mremap, 0 },
#else
{ "mremap", (sqlite3_syscall_ptr)0, 0 },
#endif
#define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[23].pCurrent)
}; /* End of the overrideable system calls */ }; /* End of the overrideable system calls */
/* /*
@@ -4005,7 +4015,7 @@ static void unixShmPurge(unixFile *pFd){
sqlite3_mutex_free(p->mutex); sqlite3_mutex_free(p->mutex);
for(i=0; i<p->nRegion; i++){ for(i=0; i<p->nRegion; i++){
if( p->h>=0 ){ if( p->h>=0 ){
munmap(p->apRegion[i], p->szRegion); osMunmap(p->apRegion[i], p->szRegion);
}else{ }else{
sqlite3_free(p->apRegion[i]); sqlite3_free(p->apRegion[i]);
} }
@@ -4278,7 +4288,7 @@ static int unixShmMap(
while(pShmNode->nRegion<=iRegion){ while(pShmNode->nRegion<=iRegion){
void *pMem; void *pMem;
if( pShmNode->h>=0 ){ if( pShmNode->h>=0 ){
pMem = mmap(0, szRegion, pMem = osMmap(0, szRegion,
pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE, pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
MAP_SHARED, pShmNode->h, szRegion*(i64)pShmNode->nRegion MAP_SHARED, pShmNode->h, szRegion*(i64)pShmNode->nRegion
); );
@@ -4501,7 +4511,7 @@ static int unixShmUnmap(
static void unixUnmapfile(unixFile *pFd){ static void unixUnmapfile(unixFile *pFd){
assert( pFd->nFetchOut==0 ); assert( pFd->nFetchOut==0 );
if( pFd->pMapRegion ){ if( pFd->pMapRegion ){
munmap(pFd->pMapRegion, pFd->mmapOrigsize); osMunmap(pFd->pMapRegion, pFd->mmapOrigsize);
pFd->pMapRegion = 0; pFd->pMapRegion = 0;
pFd->mmapSize = 0; pFd->mmapSize = 0;
pFd->mmapOrigsize = 0; pFd->mmapOrigsize = 0;
@@ -4548,7 +4558,7 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
#if defined(__linux__) && defined(_GNU_SOURCE) #if defined(__linux__) && defined(_GNU_SOURCE)
if( pFd->pMapRegion && nMap>0 ){ if( pFd->pMapRegion && nMap>0 ){
pNew = mremap(pFd->pMapRegion, pFd->mmapOrigsize, nMap, MREMAP_MAYMOVE); pNew = osMremap(pFd->pMapRegion, pFd->mmapOrigsize, nMap, MREMAP_MAYMOVE);
}else }else
#endif #endif
{ {
@@ -7196,7 +7206,7 @@ int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed /* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */ ** correctly. See ticket [bb3a86e890c8e96ab] */
assert( ArraySize(aSyscall)==22 ); assert( ArraySize(aSyscall)==24 );
/* Register all VFSes defined in the aVfs[] array */ /* Register all VFSes defined in the aVfs[] array */
for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){

View File

@@ -60,7 +60,7 @@ foreach s {
open close access getcwd stat fstat ftruncate open close access getcwd stat fstat ftruncate
fcntl read pread write pwrite fchmod fallocate fcntl read pread write pwrite fchmod fallocate
pread64 pwrite64 unlink openDirectory mkdir rmdir pread64 pwrite64 unlink openDirectory mkdir rmdir
statvfs fchown umask mmap statvfs fchown umask mmap munmap mremap
} { } {
if {[test_syscall exists $s]} {lappend syscall_list $s} if {[test_syscall exists $s]} {lappend syscall_list $s}
} }