-C Add\san\sexperimental\sfix\sto\savoid\sattempting\sto\smmap\smemory\sfrom\san\soffset\sthat\sis\snot\sa\smultiple\sof\sthe\ssystem\spage\ssize\son\ssystems\swith\spage\ssizes\slarger\sthan\s32KB.
-D 2014-03-20T08:59:47.455
+C Add\sa\stest\sto\sensure\sos_unix.c\sworks\swith\s64KiB\sOS\spages.
+D 2014-03-20T09:42:09.744
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace
F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
-F src/os_unix.c 7e2f6348e99bd215d36cb5d40161b06456089e21
+F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f
F src/os_win.c e71678ac927d0a0fb11d993db20a9748eabf808e
F src/pager.c 97a8908bf4e6e7c3adea09d3597cfa48ae33ab4e
F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e
F src/test_stat.c 9898687a6c2beca733b0dd6fe19163d987826d31
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
-F src/test_syscall.c 16dbe79fb320fadb5acd7a0a59f49e52ab2d2091
+F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb
F src/test_vfs.c e72f555ef7a59080f898fcf1a233deb9eb704ea9
F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
F test/superlock.test 1cde669f68d2dd37d6c9bd35eee1d95491ae3fc2
F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
-F test/syscall.test a653783d985108c4912cc64d341ffbbb55ad2806
+F test/syscall.test d2fdaad713f103ac611fe7ef9b724c7b69f8149c
F test/sysfault.test fa776e60bf46bdd3ae69f0b73e46ee3977a58ae6
F test/table.test 580d23530187026d4502fae74a490f0408cf2cc7
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test 8f888b50f66b78821e61ed0e233ded5de378224b
F test/wal6.test 527581f5527bf9c24394991e2be83000aace5f9e
+F test/wal64k.test 63828c2161ad76ddd4109dee0a096b6ef6895698
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
F test/wal8.test 75c42e1bc4545c277fed212f8fc9b7723cd02216
F test/wal9.test 378e76a9ad09cd9bee06c172ad3547b0129a6750
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 707ea170b3e26965b7e3982f7554d122d130b9a6
-R df2b4ee35d794d54be353b7886f4773f
-T *branch * shm-mapping-fix
-T *sym-shm-mapping-fix *
-T -sym-trunk *
+P 6f3a5c24d254fc6faf607b505bdef4a7aafc21af
+R 20782a7f4b1e1e0590156d829fb7cb71
U dan
-Z 8f1167a615e2deebf3a41d21381f8bfc
+Z 523769a43e90bd1d8c3037ea221853f3
-6f3a5c24d254fc6faf607b505bdef4a7aafc21af
\ No newline at end of file
+e3d2be3ba47cdaafd26347620ae3bc2813203f16
\ No newline at end of file
/* Forward reference */
static int openDirectory(const char*, int*);
+static int unixGetpagesize(void);
/*
** Many system calls are accessed through pointer-to-functions so that
#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 */
/*
/*
** 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
*/
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;
#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];
/* 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++){
** test_syscall list
** Return a list of all system calls. The list is constructed using
** the xNextSystemCall() VFS method.
+**
+** test_syscall pagesize PGSZ
+** If PGSZ is a power of two greater than 256, install a wrapper around
+** OS function getpagesize() that reports the system page size as PGSZ.
+** Or, if PGSZ is less than zero, remove any wrapper already installed.
*/
#include "sqliteInt.h"
int bPersist; /* 1 for persistent errors, 0 for transient */
int nCount; /* Fail after this many more calls */
int nFail; /* Number of failures that have occurred */
-} gSyscall = { 0, 0 };
+ int pgsz;
+ sqlite3_syscall_ptr orig_getpagesize;
+} gSyscall = { 0, 0, 0, 0, 0 };
static int ts_open(const char *, int, int);
static int ts_close(int fd);
return TCL_OK;
}
+static int ts_getpagesize(void){
+ return gSyscall.pgsz;
+}
+
+static int test_syscall_pagesize(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
+ int pgsz;
+ if( objc!=3 ){
+ Tcl_WrongNumArgs(interp, 2, objv, "PGSZ");
+ return TCL_ERROR;
+ }
+ if( Tcl_GetIntFromObj(interp, objv[2], &pgsz) ){
+ return TCL_ERROR;
+ }
+
+ if( pgsz<0 ){
+ if( gSyscall.orig_getpagesize ){
+ pVfs->xSetSystemCall(pVfs, "getpagesize", gSyscall.orig_getpagesize);
+ }
+ }else{
+ if( pgsz<512 || (pgsz & (pgsz-1)) ){
+ Tcl_AppendResult(interp, "pgsz out of range", 0);
+ return TCL_ERROR;
+ }
+ gSyscall.orig_getpagesize = pVfs->xGetSystemCall(pVfs, "getpagesize");
+ gSyscall.pgsz = pgsz;
+ pVfs->xSetSystemCall(
+ pVfs, "getpagesize", (sqlite3_syscall_ptr)ts_getpagesize
+ );
+ }
+
+ return TCL_OK;
+}
+
static int test_syscall(
void * clientData,
Tcl_Interp *interp,
{ "exists", test_syscall_exists },
{ "list", test_syscall_list },
{ "defaultvfs", test_syscall_defaultvfs },
+ { "pagesize", test_syscall_pagesize },
{ 0, 0 }
};
int iCmd;
fcntl read pread write pwrite fchmod fallocate
pread64 pwrite64 unlink openDirectory mkdir rmdir
statvfs fchown umask mmap munmap mremap
+ getpagesize
} {
if {[test_syscall exists $s]} {lappend syscall_list $s}
}
--- /dev/null
+# 2010 April 13
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing the operation of the library in
+# "PRAGMA journal_mode=WAL" mode.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix wal64k
+
+ifcapable !wal {finish_test ; return }
+
+db close
+test_syscall pagesize 65536
+sqlite3 db test.db
+
+do_execsql_test 1.0 {
+ PRAGMA journal_mode = WAL;
+ CREATE TABLE t1(x);
+ CREATE INDEX i1 ON t1(x);
+} {wal}
+do_test 1.1 { file size test.db-shm } {65536}
+
+do_test 1.2 {
+ execsql BEGIN
+ while {[file size test.db-shm]==65536} {
+ execsql { INSERT INTO t1 VALUES( randstr(900,1100) ) }
+ }
+ execsql COMMIT
+ file size test.db-shm
+} {131072}
+
+integrity_check 1.3
+
+db close
+test_syscall pagesize -1
+finish_test
+