wasmer_wasix/journal/effector/syscalls/
fd_set_times.rs

1use super::*;
2
3impl JournalEffector {
4    pub fn save_fd_set_times(
5        ctx: &mut FunctionEnvMut<'_, WasiEnv>,
6        fd: Fd,
7        st_atim: Timestamp,
8        st_mtim: Timestamp,
9        fst_flags: Fstflags,
10    ) -> anyhow::Result<()> {
11        Self::save_event(
12            ctx,
13            JournalEntry::FileDescriptorSetTimesV1 {
14                fd,
15                st_atim,
16                st_mtim,
17                fst_flags,
18            },
19        )
20    }
21
22    pub fn apply_fd_set_times(
23        ctx: &mut FunctionEnvMut<'_, WasiEnv>,
24        fd: Fd,
25        st_atim: Timestamp,
26        st_mtim: Timestamp,
27        fst_flags: Fstflags,
28    ) -> anyhow::Result<()> {
29        crate::syscalls::fd_filestat_set_times_internal(ctx, fd, st_atim, st_mtim, fst_flags)
30            .map_err(|err| {
31                anyhow::format_err!(
32                    "journal restore error: failed to set file times (fd={fd}, st_atim={st_atim}, st_mtim={st_mtim}, fst_flags={fst_flags:?}) - {err}")
33            })?;
34        Ok(())
35    }
36}