Skip to content

Commit f2438ad

Browse files
committed
add wasi api path_filestat_get
1 parent 503d013 commit f2438ad

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

include/proxy-wasm/exports.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Word wasi_unstable_clock_time_get(Word, uint64_t, Word);
155155
Word wasi_unstable_random_get(Word, Word);
156156
Word pthread_equal(Word left, Word right);
157157
void emscripten_notify_memory_growth(Word);
158+
Word wasi_unstable_path_filestat_get(Word fd, Word flags, Word path, Word path_len, Word buf);
158159

159160
// Support for embedders, not exported to Wasm.
160161

@@ -181,7 +182,7 @@ void emscripten_notify_memory_growth(Word);
181182
_f(fd_write) _f(fd_read) _f(fd_seek) _f(fd_close) _f(fd_fdstat_get) _f(fd_fdstat_set_flags) \
182183
_f(environ_get) _f(environ_sizes_get) _f(args_get) _f(args_sizes_get) _f(clock_time_get) \
183184
_f(random_get) _f(sched_yield) _f(poll_oneoff) _f(proc_exit) _f(path_open) \
184-
_f(fd_prestat_get) _f(fd_prestat_dir_name)
185+
_f(fd_prestat_get) _f(fd_prestat_dir_name) _f(path_filestat_get)
185186

186187
// Helpers to generate a stub to pass to VM, in place of a restricted proxy-wasm capability.
187188
#define _CREATE_PROXY_WASM_STUB(_fn) \

src/exports.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,14 @@ Word wasi_unstable_fd_close(Word /*fd*/) {
784784
return 0;
785785
}
786786

787+
// __wasi_errno_t __wasi_path_filestat_get(__wasi_fd_t fd,__wasi_lookupflags_t flags,const char
788+
// *path,size_t path_len,__wasi_filestat_t *buf);
789+
790+
Word wasi_unstable_path_filestat_get(Word /*fd*/, Word /*flags*/, Word /*path*/, Word /*path_len*/,
791+
Word /*buf*/) {
792+
return 58; // __WASI_ENOTSUP
793+
}
794+
787795
// __wasi_errno_t __wasi_fd_fdstat_get(__wasi_fd_t fd, __wasi_fdstat_t *stat)
788796
Word wasi_unstable_fd_fdstat_get(Word fd, Word statOut) {
789797
// We will only support this interface on stdout and stderr

src/wasm.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ void WasmBase::startVm(ContextBase *root_context) {
416416
"wasi_unstable.random_get", "wasi_snapshot_preview1.random_get",
417417
// Go runtime initialization
418418
"wasi_unstable.fd_fdstat_get", "wasi_snapshot_preview1.fd_fdstat_get",
419-
"wasi_unstable.fd_fdstat_set_flags", "wasi_snapshot_preview1.fd_fdstat_set_flags"});
419+
"wasi_unstable.fd_fdstat_set_flags", "wasi_snapshot_preview1.fd_fdstat_set_flags",
420+
"wasi_unstable.path_filestat_get"});
420421
if (_initialize_) {
421422
// WASI reactor.
422423
_initialize_(root_context);

0 commit comments

Comments
 (0)