From 90c56e0b91d6bf254de5127f4d9443eb3f508cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Kulcs=C3=A1r?= Date: Tue, 7 Jan 2025 12:05:45 +0100 Subject: [PATCH] Add simple perceptron program and wasi fd_prestat_set_flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ádám Kulcsár --- src/wasi/WASI.cpp | 9 +++++++++ src/wasi/WASI.h | 1 + test/programs/perceptronAlgorithm | 1 + 3 files changed, 11 insertions(+) create mode 160000 test/programs/perceptronAlgorithm diff --git a/src/wasi/WASI.cpp b/src/wasi/WASI.cpp index 5928d5fe6..253d5bcef 100644 --- a/src/wasi/WASI.cpp +++ b/src/wasi/WASI.cpp @@ -251,6 +251,15 @@ void WASI::fd_prestat_get(ExecutionState& state, Value* argv, Value* result, Ins result[0] = Value(uvwasi_fd_prestat_get(WASI::g_uvwasi, fd, buf)); } + +void WASI::fd_fdstat_set_flags(ExecutionState& state, Value* argv, Value* result, Instance* instance) +{ + uint32_t fd = argv[0].asI32(); + uint32_t flags = argv[1].asI32(); + + result[0] = Value(uvwasi_fd_fdstat_set_flags(WASI::g_uvwasi, fd, flags)); +} + void WASI::fd_prestat_dir_name(ExecutionState& state, Value* argv, Value* result, Instance* instance) { uint32_t fd = argv[0].asI32(); diff --git a/src/wasi/WASI.h b/src/wasi/WASI.h index cdb96c5f0..bfc9b3df5 100644 --- a/src/wasi/WASI.h +++ b/src/wasi/WASI.h @@ -47,6 +47,7 @@ class WASI { F(fd_read, I32I32I32I32_RI32) \ F(fd_close, I32_RI32) \ F(fd_fdstat_get, I32I32_RI32) \ + F(fd_fdstat_set_flags, I32I32_RI32) \ F(fd_prestat_dir_name, I32I32I32_RI32) \ F(fd_prestat_get, I32I32_RI32) \ F(fd_seek, I32I64I32I32_RI32) \ diff --git a/test/programs/perceptronAlgorithm b/test/programs/perceptronAlgorithm new file mode 160000 index 000000000..968157fa0 --- /dev/null +++ b/test/programs/perceptronAlgorithm @@ -0,0 +1 @@ +Subproject commit 968157fa0a4480f71f21f22d66dd23ce9e4401ac