-Release XXX
+Release v0.1.1
-----------
Additions:
- Fixes `Optional.reset` and `Optional.hash`
* Fixed missing newline in `onyx help build` documentation.
* Fixed WASI compilation due to misconfigured environment code.
+* Fixed WASI `__dir_open` permissions.
// Controls if/how the WASM function table will be exported.
export_func_table := true;
- export_func_table_name := "func_table";
+ export_func_table_name := "__indirect_function_table";
// Controls the minimum and maximum number of pages for WASM memory.
memory_min_size := 1024;
__dir_open :: (path: str, dir: &DirectoryData) -> bool {
dir_fd: FileDescriptor;
- err := wasi.path_open(4, .SymLinkFollow, path, .Directory, ~~0xffffffff, ~~0xffffffff, .Sync, &dir_fd);
- if err != .Success {
- return false;
- }
- d := new(WasiDirectory);
- d.dir_fd = dir_fd;
- d.last_cookie = 0;
+ DIR_PERMS := Rights.PathOpen | .ReadDir | .PathReadlink | .FilestatGet | .PathFilestatGet;
+ FILE_PERMS := Rights.Read | .Seek | .Tell | .FilestatGet | .PollFDReadWrite;
- *dir = d;
- return true;
+ for .[3, 4] {
+ err := wasi.path_open(it, .SymLinkFollow, path, .Directory, DIR_PERMS, FILE_PERMS, .Sync, &dir_fd);
+ if err != .Success do continue;
+
+ d := new(WasiDirectory);
+ d.dir_fd = dir_fd;
+ d.last_cookie = 0;
+
+ *dir = d;
+ return true;
+ }
+
+ return false;
}
__dir_close :: (dir: DirectoryData) {
wasi.fd_close(dir.dir_fd);
- cfree(dir);
+ if dir do cfree(dir);
}
__dir_read :: (dir: DirectoryData, out_entry: &os.DirectoryEntry) -> bool {