1 /** 2 Dummy function stubs to get sqlite3.c compiling with 3 wasi-sdk. This requires, in addition: 4 5 -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID 6 7 -lwasi-emulated-getpid 8 */ 9 typedef unsigned mode_t; 10 int fchmod(int fd, mode_t mode); 11 int fchmod(int fd, mode_t mode){ 12 return (fd && mode) ? 0 : 0; 13 } 14 typedef unsigned uid_t; 15 typedef uid_t gid_t; 16 int fchown(int fd, uid_t owner, gid_t group); 17 int fchown(int fd, uid_t owner, gid_t group){ 18 return (fd && owner && group) ? 0 : 0; 19 } 20 uid_t geteuid(void); 21 uid_t geteuid(void){return 0;} 22 #if !defined(F_WRLCK) 23 enum { 24 F_WRLCK, 25 F_RDLCK, 26 F_GETLK, 27 F_SETLK, 28 F_UNLCK 29 }; 30 #endif 31 32 #undef HAVE_PREAD 33 34 #include <wasi/api.h> 35 #define WASM__KEEP __attribute__((used)) 36 37 #if 0 38 /** 39 wasi-sdk cannot build sqlite3's default VFS without at least the following 40 functions. They are apparently syscalls which clients have to implement or 41 otherwise obtain. 42 43 https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md 44 */ 45 environ_get 46 environ_sizes_get 47 clock_time_get 48 fd_close 49 fd_fdstat_get 50 fd_fdstat_set_flags 51 fd_filestat_get 52 fd_filestat_set_size 53 fd_pread 54 fd_prestat_get 55 fd_prestat_dir_name 56 fd_read 57 fd_seek 58 fd_sync 59 fd_write 60 path_create_directory 61 path_filestat_get 62 path_filestat_set_times 63 path_open 64 path_readlink 65 path_remove_directory 66 path_unlink_file 67 poll_oneoff 68 proc_exit 69 #endif 70