From: drh Date: Tue, 19 Jun 2018 17:19:46 +0000 (+0000) Subject: Miscellaneous cleanup of OFD logic. Add an #if 0 to disable the use of X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8e6b157d792833ed590467bcab2aa656c64759c;p=thirdparty%2Fsqlite.git Miscellaneous cleanup of OFD logic. Add an #if 0 to disable the use of OFD logic, temporarily, until I can get it to actually work. FossilOrigin-Name: d849ade396d2dda4ed18f8e44d19ab218f94ef41a76a99f937238253e716dc05 --- diff --git a/manifest b/manifest index 93bfbd8c0a..02097260c7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Initial\sattempt\sto\sget\sSQLite\sworking\swith\sOFD\slocks\son\sLinux.\sThe\scode\shere\ndoes\snot\sfunction\scorrectly.\sThis\sis\san\sincremental\scheck-in\sfor\sa\swork\sin\nprogress. -D 2018-06-19T13:45:48.548 +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 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -479,7 +479,7 @@ F src/os.c 8aeb0b0f40f8f5b0da03fe49706695adaf42d2f516ab95abc72e86c245e119de F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 -F src/os_unix.c da3e1802d4c8946d76350a5f58347ae6c25a1ff028b059bc3060efa7e90a969e +F src/os_unix.c 71b17c32fce222f7dfd94dd62871dff3e645e5cd4a84d45b400469cbb39bba9f F src/os_win.c ac29c25cde4cfb4adacc59cdec4aa45698ca0e29164ea127859585ccd9faa354 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f @@ -1731,10 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 320fa69e6aa2a7d67f6444d6c13de9893e27b85c36a933b06da113d753b6aafc -R c7d7dcd11c67967d0f404fe07c1adca6 -T *branch * ofd-locks -T *sym-ofd-locks * -T -sym-trunk * +P 148f8dec9a26f11d343bfeb558fd12ba18d7f5d4d69da58fc8aa22f88e13c408 +R 83961ea01a7dee6aa8cd5a190f64b60a U drh -Z d5c78e27187e28437ed1607871e9e53d +Z 043ea47a258168f0e14367c4e0b60a6e diff --git a/manifest.uuid b/manifest.uuid index 362f9ad44d..1bbef0ffc2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -148f8dec9a26f11d343bfeb558fd12ba18d7f5d4d69da58fc8aa22f88e13c408 \ No newline at end of file +d849ade396d2dda4ed18f8e44d19ab218f94ef41a76a99f937238253e716dc05 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 066ed7856d..0482424f8b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -183,8 +183,12 @@ */ #if defined(F_OFD_SETLK) && defined(F_OFD_GETLK) # define HAVE_OFD_LOCKS 1 +# define UsesOfd(F) ((F)->eGetLk==F_OFD_GETLK) +# define UsesOldStylePosixLocks(F) ((F)->eGetLk==F_GETLK) #else # define HAVE_OFD_LOCKS 0 +# define UsesOfd(F) 0 +# define UsesOldStylePosixLocks(F) 1 # define F_OFD_SETLK 0 /* Fake value so we can use the identifier */ # define F_OFD_GETLK 0 /* Fake value so we can use the identifier */ #endif @@ -764,6 +768,12 @@ static int lockTrace(int fd, int op, struct flock *p){ zOpName = "GETLK"; }else if( op==F_SETLK || op==F_OFD_SETLK ){ zOpName = "SETLK"; +#if HAVE_OFD_LOCKS + }else if( op==F_OFD_GETLK ){ + zOpName = "OFD_GETLK"; + }else if( op==F_OFD_SETLK ){ + zOpName = "OFD_SETLK"; +#endif }else{ s = osFcntl(fd, op, p); sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); @@ -790,7 +800,7 @@ static int lockTrace(int fd, int op, struct flock *p){ ){ struct flock l2; l2 = *p; - osFcntl(fd, F_GETLK, &l2); + osFcntl(fd, op==F_SETLK ? F_GETLK : F_OFD_GETLK, &l2); if( l2.l_type==F_RDLCK ){ zType = "RDLCK"; }else if( l2.l_type==F_WRLCK ){ @@ -1702,7 +1712,7 @@ static int unixLock(sqlite3_file *id, int eFileLock){ ** return SQLITE_OK. */ if( eFileLock==SHARED_LOCK - && pFile->eGetLk==F_GETLK + && UsesOldStylePosixLocks(pFile) && (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){ assert( eFileLock==SHARED_LOCK ); @@ -1714,7 +1724,6 @@ static int unixLock(sqlite3_file *id, int eFileLock){ goto end_lock; } - /* A PENDING lock is needed before acquiring a SHARED lock and before ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will ** be released. @@ -5463,7 +5472,7 @@ static int fillInUnixFile( pNew->h = h; pNew->eSetLk = F_SETLK; pNew->eGetLk = F_GETLK; -#if HAVE_OFD_LOCKS +#if HAVE_OFD_LOCKS && 0 { struct flock lock; lock.l_whence = SEEK_SET;