1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-21 13:38:01 +03:00

Preliminary patches to get sqlite3.c building as-is in WASI environments.

FossilOrigin-Name: 19c04d71bf0f2f44d5a03288cbea3f63cf4eae2fa018ac6be4ae49a321e2b2f3
This commit is contained in:
stephan
2022-11-19 07:17:12 +00:00
parent 27a67968af
commit 8cfd2c3eeb
5 changed files with 55 additions and 11 deletions

View File

@@ -183,6 +183,37 @@
*/
#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