wasmer_wasix/journal/effector/syscalls/
fd_seek.rs

1use super::*;
2
3impl JournalEffector {
4    pub fn save_fd_seek(
5        ctx: &mut FunctionEnvMut<'_, WasiEnv>,
6        fd: Fd,
7        offset: i64,
8        whence: Whence,
9    ) -> anyhow::Result<()> {
10        Self::save_event(
11            ctx,
12            JournalEntry::FileDescriptorSeekV1 { fd, offset, whence },
13        )
14    }
15
16    pub fn apply_fd_seek(
17        ctx: &mut FunctionEnvMut<'_, WasiEnv>,
18        fd: Fd,
19        offset: i64,
20        whence: Whence,
21    ) -> anyhow::Result<()> {
22        crate::syscalls::fd_seek_internal(ctx, fd, offset, whence)?.map_err(|err| {
23            anyhow::format_err!(
24                "journal restore error: failed to seek (fd={fd}, offset={offset}, whence={whence:?}) - {err}")
25        })?;
26        Ok(())
27    }
28}