-C Miscellaneous\scleanup\sof\sOFD\slogic.\s\sAdd\san\s#if\s0\sto\sdisable\sthe\suse\sof\nOFD\slogic,\stemporarily,\suntil\sI\scan\sget\sit\sto\sactually\swork.
-D 2018-06-19T17:19:46.493
+C OFD\slocks\sare\snow\smostly\sworking,\sbut\sneed\sadditional\stests.
+D 2018-06-19T19:01:01.578
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c b1da9ef8dc834603bb0d28972378a7ce65897847f9a1e89ab800bbdf24c788ee
F src/func.c e2e3c02621a528a472933fd4733a5da635676f1461be73293f6e9f62f18d4eaa
-F src/global.c 9bf034fd560bdd514715170ed8460bb7f823cec113f0569ef3f18a20c7ccd128
+F src/global.c 58ab3df86a891570fa8f8f171174999b2fe83da854f0f879553b63961d18fddd
F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a
F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4
F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
F src/insert.c bcacf6a0d277f8fa0e4f9ffecda544a2330ca4478f904cd89564c2dd86d0b16b
F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e
F src/loadext.c 6aae5739198d96c51ae6eb97c4a5b1744c22ed7a5a565a5399a717780d48a36b
-F src/main.c a086ab7d6e4e3f07bd5789d16f977d425f9482e7b3baeeb2f17bde0e6bfb2bc1
+F src/main.c 5ec5bc48f76ecbf464b2a481e3674c36f0a9ea9fb60e39adae8c7b692206028c
F src/malloc.c 07295435093ce354c6d9063ac05a2eeae28bd251d2e63c48b3d67c12c76f7e18
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 71b17c32fce222f7dfd94dd62871dff3e645e5cd4a84d45b400469cbb39bba9f
+F src/os_unix.c 5713c9960370c3a60d7c95a12808aef1c25634291d78bd7bcebe0de90f594b30
F src/os_win.c ac29c25cde4cfb4adacc59cdec4aa45698ca0e29164ea127859585ccd9faa354
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c 8d3176c5258cc83942815ebe75b4c1f8dcf62b5e0f4d37373a14ebf23c046f9f
F src/shell.c.in 8578421c5fb2a972461b2a996f7173646e55e0dbd2a2eee30c8f5dc7d3dbadfd
-F src/sqlite.h.in a97be4beec01ea557809fe79a8e6befefa370bd7e3ba0c1a1abfe4c94ae59888
+F src/sqlite.h.in 77fde2a5afd91152daa67c7a7167699635c495d3fa733556f65049fbd5098542
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7
-F src/sqliteInt.h c8d304712b6b4e2150cbb5355b1a80427eee7b3ea1a6b5827afadf557360d7fe
+F src/sqliteInt.h 95836c91a6ce6606d157ff508e23a0c2d6ac7ac499d9495097a9e668f9b802df
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
F src/tclsqlite.c 916a92de77ec5cbe27818ca194d8cf0c58aa7ad5b87527098f6aa5a6068800ce
-F src/test1.c 553365d346ed17c099fef671204cdec6e40e701af62ef4f5527e4f2a08b98bb0
+F src/test1.c badad960c27f27130e6146d11c4bb06b1f31ce0216c5ee7878b37ca32c717598
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F src/test4.c 18ec393bb4d0ad1de729f0b94da7267270f3d8e6
F src/test_intarray.h f3b7672f5d1056eac563c0d6ea8480a660b1475c
F src/test_journal.c 619f2aa10e0d7a5f87c0f06825bc61dfce1c6b9c7f3ad990fb13de6c3b8874a3
F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd
-F src/test_malloc.c dec0aa821b230773aeb3dd11d652c1193f7cedb18a20b25659bc672288115242
+F src/test_malloc.c baf1888c5040ff190f318dbc25cfffc0bcbe5c9db5c7ccb911316e8337a08808
F src/test_md5.c 7268e1e8c399d4a5e181b64ac20e1e6f3bc4dd9fc87abac02db145a3d951fa8c
F src/test_multiplex.c e054459f7633f3ff8ce1245da724f9a8be189e4e
F src/test_multiplex.h 5436d03f2d0501d04f3ed50a75819e190495b635
F test/unionvtabfault.test 26b6854d5aef9005cd630513025690bff1b7378ae9c97b81e2a3cbe84eee0f58
F test/unique.test 93f8b2ef5ea51b9495f8d6493429b1fd0f465264
F test/unique2.test 3674e9f2a3f1fbbfd4772ac74b7a97090d0f77d2
-F test/unixexcl.test d936ba2b06794018e136418addd59a2354eeae97
+F test/unixexcl.test 2efd77088afe73dd4b810f260121a5a2271f0c527f0788c70b414577daa104cd
F test/unordered.test ffeea7747d5ba962a8009a20b7e53d68cbae05b063604c68702c5998eb50c981
F test/update.test 1148de8d913e9817717990603aadeca07aab9ddbb10a30f167cbfd8d3a3ccb60
F test/update2.test 5e67667e1c54017d964e626db765cf8bedcf87483c184f4c575bdb8c1dd2313e
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 148f8dec9a26f11d343bfeb558fd12ba18d7f5d4d69da58fc8aa22f88e13c408
-R 83961ea01a7dee6aa8cd5a190f64b60a
+P d849ade396d2dda4ed18f8e44d19ab218f94ef41a76a99f937238253e716dc05
+R 018a532db3427b0e69c05b2d8fcf6e5e
U drh
-Z 043ea47a258168f0e14367c4e0b60a6e
+Z bf846025729235094c8cf265395fdfc1
-d849ade396d2dda4ed18f8e44d19ab218f94ef41a76a99f937238253e716dc05
\ No newline at end of file
+4f1fb5c94b55c871f9ab70e19ee968f67082f70851c624028967ff11ac856e4a
\ No newline at end of file
0, /* xTestCallback */
#endif
0, /* bLocaltimeFault */
+ 1, /* bOfdLocks */
0x7ffffffe, /* iOnceResetThreshold */
SQLITE_DEFAULT_SORTERREF_SIZE /* szSorterRef */
};
}
#endif /* SQLITE_ENABLE_SORTER_REFERENCES */
+ case SQLITE_CONFIG_OFD_LOCKS: {
+ sqlite3GlobalConfig.bOfdLocks = va_arg(ap, int);
+ break;
+ }
+
default: {
rc = SQLITE_ERROR;
break;
** to locate a particular unixInodeInfo object.
*/
struct unixFileId {
+ void *pExtra;
dev_t dev; /* Device number */
#if OS_VXWORKS
struct vxworksFileId *pId; /* Unique file ID for vxworks. */
memset(&fileId, 0, sizeof(fileId));
fileId.dev = statbuf.st_dev;
+ if( UsesOfd(pFile) ) fileId.pExtra = pFile;
#if OS_VXWORKS
fileId.pId = pFile->pId;
#else
}
#endif
case SQLITE_FCNTL_OFD_LOCKS: {
- int x = *(int*)pArg;
- if( x==0 ){
- pFile->eSetLk = F_SETLK;
- pFile->eGetLk = F_GETLK;
- }
- *(int*)pArg = pFile->eSetLk==F_OFD_SETLK;
+ *(int*)pArg = UsesOfd(pFile);
return SQLITE_OK;
}
#if SQLITE_MAX_MMAP_SIZE>0
lock.l_start = UNIX_SHM_DMS;
lock.l_len = 1;
lock.l_type = F_WRLCK;
+ lock.l_pid = 0;
if( osFcntl(pShmNode->h, pDbFd->eGetLk, &lock)!=0 ) {
rc = SQLITE_IOERR_LOCK;
}else if( lock.l_type==F_UNLCK ){
OSTRACE(("OPEN %-3d %s\n", h, zFilename));
pNew->h = h;
+ pNew->pVfs = pVfs;
+ pNew->zPath = zFilename;
+ pNew->ctrlFlags = (u8)ctrlFlags;
+#if SQLITE_MAX_MMAP_SIZE>0
+ pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;
+#endif
+ if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
+ "psow", SQLITE_POWERSAFE_OVERWRITE) ){
+ pNew->ctrlFlags |= UNIXFILE_PSOW;
+ }
+ if( strcmp(pVfs->zName,"unix-excl")==0 ){
+ pNew->ctrlFlags |= UNIXFILE_EXCL;
+ }
pNew->eSetLk = F_SETLK;
pNew->eGetLk = F_GETLK;
-#if HAVE_OFD_LOCKS && 0
- {
+#if HAVE_OFD_LOCKS
+ if( sqlite3GlobalConfig.bOfdLocks && (pNew->ctrlFlags & UNIXFILE_EXCL)==0 ){
struct flock lock;
lock.l_whence = SEEK_SET;
lock.l_start = RESERVED_BYTE;
}
}
#endif
- pNew->pVfs = pVfs;
- pNew->zPath = zFilename;
- pNew->ctrlFlags = (u8)ctrlFlags;
-#if SQLITE_MAX_MMAP_SIZE>0
- pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;
-#endif
- if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
- "psow", SQLITE_POWERSAFE_OVERWRITE) ){
- pNew->ctrlFlags |= UNIXFILE_PSOW;
- }
- if( strcmp(pVfs->zName,"unix-excl")==0 ){
- pNew->ctrlFlags |= UNIXFILE_EXCL;
- }
#if OS_VXWORKS
pNew->pId = vxworksFindFileId(zFilename);
**
** <li>[[SQLITE_FCNTL_OFD_LOCKS]]
** The [SQLITE_FCNTL_OFD_LOCKS] opcode will query whether or not OFD
-** locking is currently being used for an open file, or disable the use
-** of OFD locking on the file. The argument is a pointer to an integer
-** in the callers context. If that integer is initially -1, then it is
-** set to 1 or 0 if the system is or is not using OFD locks for the file.
-** If the integer is initially 0, then OFD locks are disabled for the file.
-** This file-control is intended for testing and validation use only.
-** Applications that strive for correctness and error-free operation should
-** not mess with this file-control.
+** locking is currently being used for an open file. The argument is
+** a pointer to an integer into which is written a value of 1 if OFD
+** locks are being used for the file and 0 if OFD locks are not used.
** </ul>
*/
#define SQLITE_FCNTL_LOCKSTATE 1
** negative value for this option restores the default behaviour.
** This option is only available if SQLite is compiled with the
** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
+**
+** [[SQLITE_CONFIG_OFD_LOCKS]]
+** <dt>SQLITE_CONFIG_OFD_LOCKS
+** <dd>The SQLITE_CONFIG_OFD_LOCKS option accepts a single parameter
+** of type (int). If the value is true then OFD Locks are used on systems
+** that support that feature. If the vlaue is false, then OFD locks are
+** never used.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
+#define SQLITE_CONFIG_OFD_LOCKS 29 /* int */
/*
** CAPI3REF: Database Connection Configuration Options
int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
#endif
int bLocaltimeFault; /* True to fail localtime() calls */
+ int bOfdLocks; /* Use OFD locks on supported systems */
int iOnceResetThreshold; /* When to reset OP_Once counters */
u32 szSorterRef; /* Min size in bytes to use sorter-refs */
};
}
/*
-** tclcmd: file_control_ofd_locks DB ?DISABLE?
+** tclcmd: file_control_ofd_locks DB
**
** Run sqlite3_file_control() to query the OFD lock capability. Return
** true if OFD locks are available and false if not.
-**
-** If the DISABLE argument is true, then disable OFD locking, if it is
-** enabled. The returned value will show that OFD locks are disabled.
*/
static int SQLITE_TCLAPI file_control_ofd_locks(
ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
int rc;
int b = 0;
- if( objc!=2 && objc!=3 ){
+ if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB ?DISABLE?", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
return TCL_ERROR;
}
- if( objc==3 && Tcl_GetIntFromObj(interp, objv[2], &b) ) return TCL_ERROR;
- b = b ? 0 : -1;
+ b = 0;
rc = sqlite3_file_control(db,NULL,SQLITE_FCNTL_OFD_LOCKS,(void*)&b);
Tcl_AppendResult(interp, (rc==SQLITE_OK && b) ? "1" : "0", (char*)0);
return TCL_OK;
return TCL_OK;
}
+/*
+** Usage: sqlite3_config_ofd_locks INTEGER
+**
+** Enable or disable the use of OFD locks.
+*/
+static int SQLITE_TCLAPI test_config_ofd_locks(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ int eOk;
+
+ if( objc!=2 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "BOOL");
+ return TCL_ERROR;
+ }
+ if( Tcl_GetIntFromObj(interp, objv[1], &eOk) ){
+ return TCL_ERROR;
+ }
+
+ sqlite3_config(SQLITE_CONFIG_OFD_LOCKS, eOk);
+
+ return TCL_OK;
+}
/*
** Usage: sqlite3_dump_memsys3 FILENAME
{ "sqlite3_config_uri", test_config_uri ,0 },
{ "sqlite3_config_cis", test_config_cis ,0 },
{ "sqlite3_config_pmasz", test_config_pmasz ,0 },
+ { "sqlite3_config_ofd_locks", test_config_ofd_locks ,0 },
{ "sqlite3_db_config_lookaside",test_db_config_lookaside ,0 },
{ "sqlite3_dump_memsys3", test_dump_memsys3 ,3 },
{ "sqlite3_dump_memsys5", test_dump_memsys3 ,5 },
}
set testprefix unixexcl
+catch {db close}
+sqlite3_shutdown
+sqlite3_config_ofd_locks 0
# Test that when using VFS "unix-excl", the first time the database is read
}
}
+catch {db close}
+sqlite3_shutdown
+sqlite3_config_ofd_locks 1
+
finish_test