wasmer_wasix/journal/effector/syscalls/
path_set_times.rs1use crate::VIRTUAL_ROOT_FD;
2
3use super::*;
4
5impl JournalEffector {
6 pub fn save_path_set_times(
7 ctx: &mut FunctionEnvMut<'_, WasiEnv>,
8 fd: Fd,
9 flags: LookupFlags,
10 path: String,
11 st_atim: Timestamp,
12 st_mtim: Timestamp,
13 fst_flags: Fstflags,
14 ) -> anyhow::Result<()> {
15 Self::save_event(
16 ctx,
17 JournalEntry::PathSetTimesV1 {
18 fd,
19 flags,
20 path: path.into(),
21 st_atim,
22 st_mtim,
23 fst_flags,
24 },
25 )
26 }
27
28 pub fn apply_path_set_times(
29 ctx: &mut FunctionEnvMut<'_, WasiEnv>,
30 fd: Fd,
31 flags: LookupFlags,
32 path: &str,
33 st_atim: Timestamp,
34 st_mtim: Timestamp,
35 fst_flags: Fstflags,
36 ) -> anyhow::Result<()> {
37 if fd == VIRTUAL_ROOT_FD {
39 } else {
41 crate::syscalls::path_filestat_set_times_internal(ctx, fd, flags, path, st_atim, st_mtim, fst_flags)
42 .map_err(|err| {
43 anyhow::format_err!(
44 "journal restore error: failed to set path times (fd={fd}, flags={flags}, path={path}, st_atim={st_atim}, st_mtim={st_mtim}, fst_flags={fst_flags:?}) - {err}")
45 })?;
46 }
47 Ok(())
48 }
49}