diff options
author | dan <dan@noemail.net> | 2014-03-20 09:42:09 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2014-03-20 09:42:09 +0000 |
commit | bc76063cd2d0c7bdf59965af73a67a2ed1181641 (patch) | |
tree | d97ac7c7d94b512a6248f37f207945e9de9c22ed /src/os_unix.c | |
parent | 781e34cde3908108e2cadf2c727e8fe0e8743961 (diff) | |
download | sqlite-bc76063cd2d0c7bdf59965af73a67a2ed1181641.tar.gz sqlite-bc76063cd2d0c7bdf59965af73a67a2ed1181641.zip |
Add a test to ensure os_unix.c works with 64KiB OS pages.
FossilOrigin-Name: e3d2be3ba47cdaafd26347620ae3bc2813203f16
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 151ed890a..fc320a492 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -323,6 +323,7 @@ static int posixFchown(int fd, uid_t uid, gid_t gid){ /* Forward reference */ static int openDirectory(const char*, int*); +static int unixGetpagesize(void); /* ** Many system calls are accessed through pointer-to-functions so that @@ -446,6 +447,9 @@ static struct unix_syscall { #define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[23].pCurrent) #endif + { "getpagesize", (sqlite3_syscall_ptr)unixGetpagesize, 0 }, +#define osGetpagesize ((int(*)(void))aSyscall[24].pCurrent) + }; /* End of the overrideable system calls */ /* @@ -4107,8 +4111,11 @@ static int unixShmSystemLock( /* ** Return the system page size. +** +** This function should not be called directly by other code in this file. +** Instead, it should be called via macro osGetpagesize(). */ -static int unixGetPagesize(void){ +static int unixGetpagesize(void){ #if defined(_BSD_SOURCE) return getpagesize(); #else @@ -4127,7 +4134,7 @@ static int unixGetPagesize(void){ */ static int unixShmRegionPerMap(void){ int shmsz = 32*1024; /* SHM region size */ - int pgsz = unixGetPagesize(); /* System page size */ + int pgsz = osGetpagesize(); /* System page size */ assert( ((pgsz-1)&pgsz)==0 ); /* Page size must be a power of 2 */ if( pgsz<shmsz ) return 1; return pgsz/shmsz; @@ -4710,7 +4717,7 @@ static void unixRemapfile( #if HAVE_MREMAP i64 nReuse = pFd->mmapSize; #else - const int szSyspage = unixGetPagesize(); + const int szSyspage = osGetpagesize(); i64 nReuse = (pFd->mmapSize & ~(szSyspage-1)); #endif u8 *pReq = &pOrig[nReuse]; @@ -7458,7 +7465,7 @@ int sqlite3_os_init(void){ /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==24 ); + assert( ArraySize(aSyscall)==25 ); /* Register all VFSes defined in the aVfs[] array */ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ |