Skip to content

Commit 94c70b7

Browse files
committed
Add fd_tell wasi stub
The usage of fd_tell was introduced in Rust 1.87 by rust-lang/rust#137165
1 parent e167107 commit 94c70b7

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

arbitrator/caller-env/src/wasip1_stub.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ pub fn fd_seek<M: MemAccess, E: ExecEnv>(
139139
ERRNO_BADF
140140
}
141141

142+
/// Get the offset of the file descriptor. Unsupported.
143+
pub fn fd_tell<M :MemAccess, E: ExecEnv>(
144+
_: &mut M,
145+
_: &mut E,
146+
_fd: u32,
147+
_offset: GuestPtr
148+
) -> Errno {
149+
ERRNO_BADF
150+
}
151+
142152
/// Syncs file contents to disk. Unsupported.
143153
pub fn fd_datasync<M: MemAccess, E: ExecEnv>(_: &mut M, _: &mut E, _fd: u32) -> Errno {
144154
ERRNO_BADF

arbitrator/jit/src/machine.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub fn create(opts: &Opts, env: WasmEnv) -> (Instance, FunctionEnv<WasmEnv>, Sto
9595
"fd_sync" => func!(wasip1_stub::fd_sync),
9696
"fd_seek" => func!(wasip1_stub::fd_seek),
9797
"fd_datasync" => func!(wasip1_stub::fd_datasync),
98+
"fd_tell" => func!(wasip1_stub::fd_tell),
9899
"path_open" => func!(wasip1_stub::path_open),
99100
"path_create_directory" => func!(wasip1_stub::path_create_directory),
100101
"path_remove_directory" => func!(wasip1_stub::path_remove_directory),

arbitrator/jit/src/wasip1_stub.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ wrap! {
6161
filesize: u32
6262
) -> Errno;
6363

64+
fn fd_tell(
65+
fd: u32,
66+
offset: GuestPtr
67+
) -> Errno;
68+
6469
fn fd_datasync(_fd: u32) -> Errno;
6570

6671
fn path_open(

arbitrator/wasm-libraries/wasi-stub/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ wrap! {
8585
filesize: u32
8686
) -> Errno;
8787

88+
fn fd_tell(
89+
fd: u32,
90+
offset: GuestPtr
91+
) -> Errno;
92+
8893
fn fd_datasync(fd: u32) -> Errno;
8994

9095
fn path_open(

0 commit comments

Comments
 (0)