From: jan.nijtmans Date: Fri, 28 Mar 2025 08:59:40 +0000 (+0000) Subject: Second round of cygwin fixes: this makes the full "unix" vfs usable with Cygwin as... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18284c0ca13d5d488f6a67279c7cd902b4a3a652;p=thirdparty%2Fsqlite.git Second round of cygwin fixes: this makes the full "unix" vfs usable with Cygwin as well. Not all tests are working yet. WIP! FossilOrigin-Name: 648aca5b47a2a9d070791f6924baac36a3e45706539678b310d4c8ab37129a34 --- diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 67895a2434..f888af65e2 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -428,7 +428,11 @@ proc sqlite-configure-phase1 {buildMode} { sqlite-autoreconfig proj-file-extensions if {".exe" eq [get-define TARGET_EXEEXT]} { - define SQLITE_OS_UNIX 0 + if {$::tcl_platform(platform) eq "unix"} { + define SQLITE_OS_UNIX 1 + } else { + define SQLITE_OS_UNIX 0 + } define SQLITE_OS_WIN 1 } else { define SQLITE_OS_UNIX 1 diff --git a/manifest b/manifest index 7e2ec3c8c9..bdc99e8680 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk -D 2025-03-28T07:09:56.542 +C Second\sround\sof\scygwin\sfixes:\sthis\smakes\sthe\sfull\s"unix"\svfs\susable\swith\sCygwin\sas\swell.\nNot\sall\stests\sare\sworking\syet.\sWIP! +D 2025-03-28T08:59:40.930 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -52,7 +52,7 @@ F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1 F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cac07d75249fa127500b8e96080dc807e9ae97fe98d29e84a17bc28f4628e93f -F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523 +F autosetup/sqlite-config.tcl 8d7460cfd618e71c82a1c28fafc04044efc55708478dd6f446987861a5618c2b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -748,7 +748,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c a5f0366266be993ebf533808f22cb7a788624805b55bc45424ceed3f48c54a16 F src/json.c 81e2012796a0e139b18c50ee3444c8ef86a020ab360511882216f5b610657e0c F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa -F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 +F src/loadext.c 4cde2939fab9a640d8123882a81309543267edbcd78b1fba1697475a39557488 F src/main.c 07f78d917ffcdf327982840cfd8e855fd000527a2ea5ace372ce4febcbd0bf97 F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 @@ -760,18 +760,18 @@ F src/memdb.c a3feb427cdd4036ea2db0ba56d152f14c8212ca760ccb05fb7aa49ff6b897df3 F src/memjournal.c c283c6c95d940eb9dc70f1863eef3ee40382dbd35e5a1108026e7817c206e8a0 F src/msvc.h 80b35f95d93bf996ccb3e498535255f2ef1118c78764719a7cd15ab4106ccac9 F src/mutex.c 06bcd9c3dbf2d9b21fcd182606c00fafb9bfe0287983c8e17acd13d2c81a2fa9 -F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a +F src/mutex.h e2159f6ce3201c90d63045701f0eaa669e9154e8b79d000982d2fa1467432a94 F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 F src/mutex_unix.c f7ee5a2061a4c11815a2bf4fc0e2bfa6fb8d9dc89390eb613ca0cec32fc9a3d1 -F src/mutex_w32.c 28f8d480387db5b2ef5248705dd4e19db0cfc12c3ba426695a7d2c45c48e6885 +F src/mutex_w32.c 8a0b91b407adae0936725bf31927c9d0b170596fa0adb246e5f800e97efacb44 F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878 F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a -F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 -F src/os_unix.c 410185df4900817c218c0efdb8064b3481af88cb3f7cea7392f820b6eebc7889 -F src/os_win.c caab8bc13f1d64a2ba6b8af35d660ffe25083df3493d9082d7a461a5e9950a50 +F src/os_setup.h 0a44e77a6bb4e8a93e27ade391e6796a3af34fc16c314619eca82dcfade7edb9 +F src/os_unix.c 2de3a1aa898624ee23da7d47d6df257836058677f727d41f81b56e1a17272ff8 +F src/os_win.c 0b2abb73fb231ed3422128928700da78b1c822d97cf9bf8447f4d4f05ae68563 F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19 F src/pager.c 9fbb541b46125dfa8914827575e6bb4d15048caa008073b1709112d495d7983b F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 @@ -779,7 +779,7 @@ F src/parse.y e426d7323311554c75b0aebc426d0fe3c88d9777ffefed236f343ad9e661dc4c F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd -F src/pragma.c 30b535d0a66348df844ee36f890617b4cf45e9a22dcbc47ec3ca92909c50aaf1 +F src/pragma.c d53aae3c33d5e482fcb66b159e6d8c138d1a414e1621e76d3ab665701eb50277 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 33fc0d7643c848a098afdcb6e1db6de12379d47084b1cd0912cfce1d09345e44 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c @@ -796,7 +796,7 @@ F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c 767a11d470b031e85f51b8924a0e8929b2362ff1975aee3474a10eba3c2e0d36 F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395 -F src/test1.c e89a11192dd15da20e8f7dc0731297182b2fff56cf4afe6ca6f9aeab890595c5 +F src/test1.c 6f859057584d35bb2da39fa0ca4feb30b825e9ba0e442a2b1dc00f074ed1879c F src/test2.c 62f0830958f9075692c29c6de51b495ae8969e1bef85f239ffcd9ba5fb44a5ff F src/test3.c 432646f581d8af1bb495e58fc98234380250954f5d5535e507fc785eccc3987a F src/test4.c 0ac87fc13cdb334ab3a71823f99b6c32a6bebe5d603cd6a71d84c823d43a25a0 @@ -1735,7 +1735,7 @@ F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 463ae33b8bf75ac77451df19bd65e7c415c2e9891227c7c9e657d0a2d8e1074a F test/testrunner.tcl 228732ca62ea60e97785e13528bd36627cf3c115d59364a5181ed7f85fd0031d x -F test/testrunner_data.tcl 07f2d36a6321bfd196975aca237db6bba1991032809264a1abeb62e697196d20 +F test/testrunner_data.tcl b49fb8949506a8d9a39fd00c36d87c940b077f6cc38b77947328313c2f75d639 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -2160,7 +2160,7 @@ F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14 F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef F tool/mkopcodeh.tcl 2b4e6967a670ef21bf53a164964c35c6163277d002a4c6f56fa231d68c88d023 F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa -F tool/mkpragmatab.tcl 3801ce32f8c55fe63a3b279f231fb26c2c1a2ea9a09d2dd599239d87a609acec +F tool/mkpragmatab.tcl 5615f8ea9ae6990b73da765c5f121117cbc2a5197b65bed25c56f71c7ab2f42a F tool/mkshellc.tcl 9ce74de0fa904a2c56a96f8d8b5261246bacb0eaa8d7e184f9e18ff94145ebbc F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c6e4e1cf2b70d2e603ea3faabd9cb5fbd9f5497672574283ace8c62984dfbb97 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85 -R d6dc8c3c7bf9724429b6bef84640ccd0 +P 6a449918c20e9ec001877de34a8f593a5039c0b0a04ee13adab76934a2afcc39 +R b23b5e6a9bdc8fefd483aa847126706f U jan.nijtmans -Z 38dfb15f7bbfaab098008f6182374596 +Z da12dca84a4fa4c6d7a98e30f40b8fd6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9335035b94..9e17b79276 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6a449918c20e9ec001877de34a8f593a5039c0b0a04ee13adab76934a2afcc39 +648aca5b47a2a9d070791f6924baac36a3e45706539678b310d4c8ab37129a34 diff --git a/src/loadext.c b/src/loadext.c index 7e0ae25437..5193061254 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -559,7 +559,7 @@ static int sqlite3LoadExtension( /* Shared library endings to try if zFile cannot be loaded as written */ static const char *azEndings[] = { -#if SQLITE_OS_WIN +#if SQLITE_OS_WIN || defined(__CYGWIN__) "dll" #elif defined(__APPLE__) "dylib" diff --git a/src/mutex.h b/src/mutex.h index a6806a2505..e2129a64a5 100644 --- a/src/mutex.h +++ b/src/mutex.h @@ -41,7 +41,7 @@ # define SQLITE_MUTEX_OMIT #endif #if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP) -# if SQLITE_OS_UNIX +# if SQLITE_OS_UNIX || defined(__CYGWIN__) # define SQLITE_MUTEX_PTHREADS # elif SQLITE_OS_WIN # define SQLITE_MUTEX_W32 diff --git a/src/mutex_w32.c b/src/mutex_w32.c index 7eb5b50be1..9746855a56 100644 --- a/src/mutex_w32.c +++ b/src/mutex_w32.c @@ -13,7 +13,7 @@ */ #include "sqliteInt.h" -#if SQLITE_OS_WIN +#ifdef _WIN32 /* ** Include code that is common to all os_*.c files */ diff --git a/src/os_setup.h b/src/os_setup.h index a82f86fd9f..6b49f70302 100644 --- a/src/os_setup.h +++ b/src/os_setup.h @@ -40,7 +40,11 @@ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \ defined(__MINGW32__) || defined(__BORLANDC__) # define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 +# if defined(__CYGWIN__) +# define SQLITE_OS_UNIX 1 +# else +# define SQLITE_OS_UNIX 0 +# endif # else # define SQLITE_OS_WIN 0 # define SQLITE_OS_UNIX 1 diff --git a/src/os_unix.c b/src/os_unix.c index 1146545fea..e4e5ed82cd 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -420,6 +420,7 @@ static int unixGetpagesize(void); ** testing and sandboxing. The following array holds the names and pointers ** to all overrideable system calls. */ +#define aSyscall aUnixSyscall static struct unix_syscall { const char *zName; /* Name of the system call */ sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ @@ -1273,7 +1274,7 @@ static int unixLogErrorAtLine( const char *zPath, /* File path associated with error */ int iLine /* Source line number where error occurred */ ){ - char *zErr; /* Message from strerror() or equivalent */ + const char *zErr; /* Message from strerror() or equivalent */ int iErrno = errno; /* Saved syscall error number */ /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use @@ -3568,9 +3569,13 @@ static int unixWrite( ** Count the number of fullsyncs and normal syncs. This is used to test ** that syncs and fullsyncs are occurring at the right times. */ +#if SQLITE_OS_WIN +extern int sqlite3_sync_count, sqlite3_fullsync_count; +#else int sqlite3_sync_count = 0; int sqlite3_fullsync_count = 0; #endif +#endif /* ** We do not trust systems to provide a working fdatasync(). Some do. @@ -6040,7 +6045,7 @@ static int unixGetTempname(int nBuf, char *zBuf){ sqlite3_randomness(sizeof(r), &r); assert( nBuf>2 ); zBuf[nBuf-2] = 0; - sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c", + sqlite3_snprintf(nBuf, zBuf, "%s/" SQLITE_TEMP_FILE_PREFIX "%llx%c", zDir, r, 0); if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){ rc = SQLITE_ERROR; @@ -6879,7 +6884,11 @@ static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){ ** sqlite3OsCurrentTime() during testing. */ #ifdef SQLITE_TEST +# if SQLITE_OS_WIN +extern int sqlite3_current_time; /* Fake system time in seconds since 1970. */ +# else int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ +# endif #endif /* @@ -8147,7 +8156,14 @@ static int proxyClose(sqlite3_file *id) { ** necessarily been initialized when this routine is called, and so they ** should not be used. */ +#if SQLITE_OS_WIN +#if defined(SQLITE_AMALGAMATION) +static +#endif +int sqlite3_os_unix_init(void){ +#else int sqlite3_os_init(void){ +#endif /* ** The following macro defines an initializer for an sqlite3_vfs object. ** The name of the VFS is NAME. The pAppData is a pointer to a pointer @@ -8270,6 +8286,8 @@ int sqlite3_os_init(void){ return SQLITE_OK; } +#undef aSyscall +#if !SQLITE_OS_WIN /* ** Shutdown the operating system interface. ** @@ -8281,5 +8299,6 @@ int sqlite3_os_end(void){ unixBigLock = 0; return SQLITE_OK; } +#endif /* !SQLITE_OS_WIN */ #endif /* SQLITE_OS_UNIX */ diff --git a/src/os_win.c b/src/os_win.c index 0dd56af583..cb57cacce9 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1490,6 +1490,9 @@ void sqlite3_win32_write_debug(const char *zBuf, int nBuf){ static HANDLE sleepObj = NULL; #endif +#if defined(__CYGWIN__) && defined(SQLITE_AMALGAMATION) +static +#endif void sqlite3_win32_sleep(DWORD milliseconds){ #if SQLITE_OS_WINRT if ( sleepObj==NULL ){ @@ -6626,6 +6629,10 @@ static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ return e; } +#if SQLITE_OS_UNIX && !defined(SQLITE_AMALGAMATION) +int sqlite3_os_unix_init(void); +#endif + /* ** Initialize and deinitialize the operating system interface. */ diff --git a/src/pragma.c b/src/pragma.c index 2b4d465e71..af3d090781 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1025,7 +1025,7 @@ void sqlite3Pragma( break; } -#if SQLITE_OS_WIN +#ifdef _WIN32 /* ** PRAGMA data_store_directory ** PRAGMA data_store_directory = ""|"directory_name" diff --git a/src/test1.c b/src/test1.c index f86fef36ff..6c3c047d8f 100644 --- a/src/test1.c +++ b/src/test1.c @@ -8017,7 +8017,7 @@ static void SQLITE_CDECL win32_file_locker(void *pAppData){ } #endif -#ifdef _WIN32 +#if SQLITE_OS_WIN /* ** lock_win32_file FILENAME DELAY1 DELAY2 ** diff --git a/test/testrunner_data.tcl b/test/testrunner_data.tcl index ade126a64d..74985534df 100644 --- a/test/testrunner_data.tcl +++ b/test/testrunner_data.tcl @@ -529,7 +529,8 @@ proc make_script {cfg srcdir bMsvc} { # Define either SQLITE_OS_WIN or SQLITE_OS_UNIX, as appropriate. if {$::tcl_platform(os) eq "Windows NT"} { lappend opts -DSQLITE_OS_WIN=1 - } else { + } + if {$::tcl_platform(platform) eq "unix"} { lappend opts -DSQLITE_OS_UNIX=1 } diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 70988cf82e..78127f74ad 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -216,7 +216,7 @@ set pragma_def { NAME: data_store_directory FLAG: NoColumns1 - IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN + IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && defined(_WIN32) NAME: lock_proxy_file FLAG: NoColumns1