wasmer_wasix/journal/effector/
mod.rs

1pub(super) use std::{borrow::Cow, ops::Range, sync::MutexGuard, time::SystemTime};
2
3pub(super) use anyhow::bail;
4pub(super) use bytes::Bytes;
5pub(super) use wasmer::{FunctionEnvMut, WasmPtr};
6pub(super) use wasmer_types::MemorySize;
7pub(super) use wasmer_wasix_types::{
8    types::__wasi_ciovec_t,
9    wasi::{
10        Advice, EpollCtl, EpollEventCtl, Errno, ExitCode, Fd, Fdflags, Fdflagsext, Filesize,
11        Fstflags, LookupFlags, Oflags, Rights, Snapshot0Clockid, Timestamp, Whence,
12    },
13};
14
15pub(super) use crate::{
16    WasiEnv, WasiThreadId, mem_error_to_wasi,
17    os::task::process::WasiProcessInner,
18    syscalls::{FdWriteSource, fd_write_internal},
19    utils::map_snapshot_err,
20};
21
22use super::*;
23
24#[cfg(feature = "journal")]
25mod syscalls {
26    pub(super) use super::*;
27    mod chdir;
28    mod clock_time;
29    mod epoll_create;
30    mod epoll_ctl;
31    mod fd_advise;
32    mod fd_allocate;
33    mod fd_close;
34    mod fd_duplicate;
35    mod fd_event;
36    mod fd_pipe;
37    mod fd_renumber;
38    mod fd_seek;
39    mod fd_set_fdflags;
40    mod fd_set_flags;
41    mod fd_set_rights;
42    mod fd_set_size;
43    mod fd_set_times;
44    mod fd_write;
45    mod path_create_directory;
46    mod path_link;
47    mod path_open;
48    mod path_remove_directory;
49    mod path_rename;
50    mod path_set_times;
51    mod path_symlink;
52    mod path_unlink;
53    mod port_addr_add;
54    mod port_addr_clear;
55    mod port_addr_remove;
56    mod port_bridge;
57    mod port_dhcp_acquire;
58    mod port_gateway_set;
59    mod port_route_add;
60    mod port_route_clear;
61    mod port_route_remove;
62    mod port_unbridge;
63    mod sock_accept;
64    mod sock_bind;
65    mod sock_connect;
66    mod sock_join_ipv4_multicast;
67    mod sock_join_ipv6_multicast;
68    mod sock_leave_ipv4_multicast;
69    mod sock_leave_ipv6_multicast;
70    mod sock_listen;
71    mod sock_open;
72    mod sock_pair;
73    mod sock_send;
74    mod sock_send_file;
75    mod sock_send_to;
76    mod sock_set_opt_flag;
77    mod sock_set_opt_size;
78    mod sock_set_opt_time;
79    mod sock_shutdown;
80    mod tty_set;
81}
82#[cfg(feature = "journal")]
83mod memory_and_snapshot;
84#[cfg(feature = "journal")]
85mod process_exit;
86#[cfg(feature = "journal")]
87mod save_event;
88#[cfg(feature = "journal")]
89mod thread_exit;
90#[cfg(feature = "journal")]
91mod thread_state;
92
93/// The journal effector is an adapter that will be removed in a future refactor.
94/// Its purpose is to put the code that does mappings from WASM memory through its
95/// abstractions into concrete journal objects that can be stored. Instead of this
96/// what should be done is that the syscalls themselves can be represented as a
97/// strongly typed object that can be passed directly to the journal but in order
98/// to do this we require an extensive refactoring of the WASIX syscalls which
99/// is not in scope at this time.
100///
101/// Separating this out now makes it easier to eliminate later without hurting the
102/// journal event abstraction through leaking abstraction layers.
103#[derive(Debug, Clone)]
104pub struct JournalEffector {}