]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Preliminary patches to get sqlite3.c building as-is in WASI environments.
authorstephan <stephan@noemail.net>
Sat, 19 Nov 2022 07:17:12 +0000 (07:17 +0000)
committerstephan <stephan@noemail.net>
Sat, 19 Nov 2022 07:17:12 +0000 (07:17 +0000)
FossilOrigin-Name: 19c04d71bf0f2f44d5a03288cbea3f63cf4eae2fa018ac6be4ae49a321e2b2f3

manifest
manifest.uuid
src/os_unix.c
src/shell.c.in
src/sqlite.h.in

index 3df90b2d8ac27cfb0354d03f9bb2eaf7ba176314..0d31c2ee2907b43305649be9111421ea7653d448 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sbuild\sof\ssqlite3.mjs\s(ES6\smodule),\sadd\sa\stest\sapp\sfor\sit,\sand\sinclude\sit\sin\sthe\sdist\sbuild.
-D 2022-11-19T05:26:45.763
+C Preliminary\spatches\sto\sget\ssqlite3.c\sbuilding\sas-is\sin\sWASI\senvironments.
+D 2022-11-19T07:17:12.124
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -623,7 +623,7 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
 F src/os_kv.c 0e59600d25b72034c7666b8b7dcc527f039b5d9c16f24a7eca4c08c66f63c364
 F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
-F src/os_unix.c 287aa5f5691a2b356780c63e83abaa33549add84227b8313395f04088486d79c
+F src/os_unix.c fc309252d6c86d7ae32e25d6413249789428aab600ffa9db050532bbe3a92ce2
 F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c d3122cf67f327f1e2df12d06236a3473a8099542071e257067552f42917f172d
@@ -640,8 +640,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c 9886d6669f5787471aab6ae52af76fad90b53edb1c218fc9ed9d953363bc5184
-F src/shell.c.in 16740a86346ba9823f92528ec588f2b74f68166dac965dabd19883ace230f11d
-F src/sqlite.h.in 100fc660c2f19961b8ed8437b9d53d687de2f8eb2b96437ec6da216adcb643ca
+F src/shell.c.in f5b696b44319a7c820b1b2922ce8d34fdf330337beaa6e87c0fd85c5c92bcd34
+F src/sqlite.h.in 1d18494193ea4772a4a372e05f48d3ef0a14534bc2e1c88b942b89dcd9b14e4b
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
 F src/sqliteInt.h 1a2cec0f7682da69975eb203fef2058949051ff500445b997d8047cbd8813315
@@ -2057,8 +2057,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 10c723d96d61d2e552ec1102563d58f1eb11bc3d30e03606fd8e0279c5a9043a
-R 222130501cabad70ae0d5e4c47519919
+P 2e783670e10b59e67c14b0db7f4803b41790cc7730de221d54fa2d4483cfba33
+R 15320a286fec35f9e29ba0e0afc5c3c6
+T *branch * wasi-patches
+T *sym-wasi-patches *
+T -sym-trunk * Cancelled\sby\sbranch.
 U stephan
-Z bbe51f75fec2c52a531f67e9a6ac36f6
+Z 0b7069cc0349cc87f94f97d371c39591
 # Remove this line to create a well-formed Fossil manifest.
index 78bd7a46af525d1d2fddbea9a1fbefd675d531b8..285b57f1df3bec13666739079ce373fa367141a5 100644 (file)
@@ -1 +1 @@
-2e783670e10b59e67c14b0db7f4803b41790cc7730de221d54fa2d4483cfba33
\ No newline at end of file
+19c04d71bf0f2f44d5a03288cbea3f63cf4eae2fa018ac6be4ae49a321e2b2f3
\ No newline at end of file
index c390b5188864e796ee13a56716f297358af8de59..a32c68d661b84db573dab9fcc893d3ed1bf0dc2f 100644 (file)
 */
 #define SQLITE_MAX_SYMLINKS 100
 
+/*
+** Remove and stub certain info for WASI (WebAssembly System
+** Interface) builds.
+*/
+#ifdef SQLITE_WASI
+# undef HAVE_FCHMOD
+# undef HAVE_FCHOWN
+# ifndef SQLITE_DEFAULT_UNIX_VFS
+#  define SQLITE_DEFAULT_UNIX_VFS "unix-dotfile"
+   /* ^^^ should SQLITE_DEFAULT_UNIX_VFS be "unix-none"? */
+# endif
+# ifndef F_RDLCK
+#  define F_RDLCK 0
+#  define F_WRLCK 1
+#  define F_UNLCK 2
+#  if __LONG_MAX == 0x7fffffffL
+#   define F_GETLK 12
+#   define F_SETLK 13
+#   define F_SETLKW 14
+#  else
+#   define F_GETLK 5
+#   define F_SETLK 6
+#   define F_SETLKW 7
+#  endif
+# endif
+#else /* !SQLITE_WASI */
+# ifndef HAVE_FCHMOD
+#  define HAVE_FCHMOD
+# endif
+#endif /* SQLITE_WASI */
+
 /* Always cast the getpid() return type for compatibility with
 ** kernel modules in VxWorks. */
 #define osGetpid(X) (pid_t)getpid()
@@ -457,7 +488,11 @@ static struct unix_syscall {
 #define osPwrite64  ((ssize_t(*)(int,const void*,size_t,off64_t))\
                     aSyscall[13].pCurrent)
 
+#if defined(HAVE_FCHMOD)
   { "fchmod",       (sqlite3_syscall_ptr)fchmod,          0  },
+#else
+  { "fchmod",       (sqlite3_syscall_ptr)0,               0  },
+#endif
 #define osFchmod    ((int(*)(int,mode_t))aSyscall[14].pCurrent)
 
 #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
index db8d987660353e3f1195ab975d49a751bcc88ad4..36999ed44a109eaca3c641f6e32de9a6cb79de42 100644 (file)
@@ -111,7 +111,7 @@ typedef unsigned char u8;
 
 #if !defined(_WIN32) && !defined(WIN32)
 # include <signal.h>
-# if !defined(__RTP__) && !defined(_WRS_KERNEL)
+# if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
 #  include <pwd.h>
 # endif
 #endif
@@ -192,7 +192,7 @@ typedef unsigned char u8;
  /* Make sure isatty() has a prototype. */
  extern int isatty(int);
 
-# if !defined(__RTP__) && !defined(_WRS_KERNEL)
+# if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
   /* popen and pclose are not C89 functions and so are
   ** sometimes omitted from the <stdio.h> header */
    extern FILE *popen(const char*,const char*);
index c2fc4e5a6a72627bfe0f53b291f56ea973854997..9ff5163b13a13ee79b595701efddf1814012aac2 100644 (file)
@@ -10472,6 +10472,12 @@ int sqlite3_deserialize(
 # undef double
 #endif
 
+#if defined(__wasi__) || defined(WASM_WASI)
+# ifndef SQLITE_WASI
+#  define SQLITE_WASI
+# endif
+#endif
+
 #ifdef __cplusplus
 }  /* End of the 'extern "C"' block */
 #endif