wasmer_wasix/syscalls/wasix/proc_snapshot.rs
1use super::*;
2use crate::syscalls::*;
3
4/// Explicitly snapshots the process state.
5#[instrument(level = "trace", skip_all, ret)]
6pub fn proc_snapshot<M: MemorySize>(
7 mut ctx: FunctionEnvMut<'_, WasiEnv>,
8) -> Result<Errno, WasiError> {
9 WasiEnv::do_pending_operations(&mut ctx)?;
10
11 // If we have an Explicit trigger, process that...
12 ctx = wasi_try_ok!(maybe_snapshot_once::<M>(ctx, SnapshotTrigger::Explicit)?);
13 // ... if not, we may still have an external request for a snapshot, so do that as well
14 ctx = wasi_try_ok!(maybe_snapshot::<M>(ctx)?);
15 Ok(Errno::Success)
16}