diff options
author | stephan <stephan@noemail.net> | 2022-11-19 07:39:31 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-11-19 07:39:31 +0000 |
commit | 9a92d53cf5f3aa0452d7a9638c0b15f4c87d83ad (patch) | |
tree | 4df0ffe556437c95e3835f9c7c116256e961383d /src/os_unix.c | |
parent | 8cfd2c3eeb6d34d3481aadf20d8eb5f5a5c793be (diff) | |
download | sqlite-9a92d53cf5f3aa0452d7a9638c0b15f4c87d83ad.tar.gz sqlite-9a92d53cf5f3aa0452d7a9638c0b15f4c87d83ad.zip |
Account for lack of mmap(), getpid(), and shared memory APIs in wasi.
FossilOrigin-Name: 80ff026fb4b2203eea53d4930c1e9bb138db951fb408739c7d5c776fb397b665
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a32c68d66..af22d3cf8 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -95,7 +95,8 @@ #include <time.h> #include <sys/time.h> /* amalgamator: keep */ #include <errno.h> -#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 +#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \ + && !defined(SQLITE_WASI) # include <sys/mman.h> #endif @@ -190,6 +191,8 @@ #ifdef SQLITE_WASI # undef HAVE_FCHMOD # undef HAVE_FCHOWN +# undef HAVE_MREMAP +# define HAVE_MREMAP 0 # ifndef SQLITE_DEFAULT_UNIX_VFS # define SQLITE_DEFAULT_UNIX_VFS "unix-dotfile" /* ^^^ should SQLITE_DEFAULT_UNIX_VFS be "unix-none"? */ @@ -214,9 +217,13 @@ # endif #endif /* SQLITE_WASI */ +#ifdef SQLITE_WASI +# define osGetpid(X) 1 +#else /* Always cast the getpid() return type for compatibility with ** kernel modules in VxWorks. */ -#define osGetpid(X) (pid_t)getpid() +# define osGetpid(X) (pid_t)getpid() +#endif /* ** Only set the lastErrno if the error code is a real error and not @@ -528,14 +535,16 @@ static struct unix_syscall { #endif #define osGeteuid ((uid_t(*)(void))aSyscall[21].pCurrent) -#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 +#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \ + && !defined(SQLITE_WASI) { "mmap", (sqlite3_syscall_ptr)mmap, 0 }, #else { "mmap", (sqlite3_syscall_ptr)0, 0 }, #endif #define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[22].pCurrent) -#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 +#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \ + && !defined(SQLITE_WASI) { "munmap", (sqlite3_syscall_ptr)munmap, 0 }, #else { "munmap", (sqlite3_syscall_ptr)0, 0 }, |