pub struct Ctx {
pub config: Config,
pub root: Arc<View>,
pub cache: Arc<DirCache>,
pub mem: Mem,
pub procs: Arc<ProcTable>,
pub no_ptrace: bool,
pub mailbox: Option<i32>,
nested: AtomicBool,
}Expand description
Everything handlers need, shared read-mostly between all threads.
Fields§
§config: Config§root: Arc<View>The view of the first tracee, and of every process without one of its own.
cache: Arc<DirCache>Directory cache shared by every view.
mem: Mem§procs: Arc<ProcTable>Per-process bookkeeping, shared with fs for /proc magic links.
no_ptrace: boolTrue when running without ptrace: the former ptrace tier is served
through notifications with in-place rewrites (see syscall::direct).
mailbox: Option<i32>The mailbox descriptor of the guest-stub restricted mode, installed
into every process that execs (see guest_stub); None elsewhere.
nested: AtomicBoolSet once any process has a view of its own; until then every lookup answers the root view without touching the process table.
Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn new(config: Config, no_ptrace: bool) -> Ctx
pub fn new(config: Config, no_ptrace: bool) -> Ctx
Builds the shared state from a configuration.
§Arguments
config- Parsed command line.no_ptrace- Run without a ptrace tier.
Sourcepub fn trap_mode(&self) -> bool
pub fn trap_mode(&self) -> bool
Whether guests run the stub of the guest-stub restricted mode.
§Returns
true when a mailbox was set up.
Sourcepub fn enter_view(&self, tid: i32, view: Arc<View>, cwd: Vec<u8>)
pub fn enter_view(&self, tid: i32, view: Arc<View>, cwd: Vec<u8>)
Moves the process of thread tid into view, with cwd as its
working directory there when the working directory is virtual.
§Arguments
tid- Thread or process id.view- The view to enter.cwd- Working directory as a guest path ofview.
Sourcepub fn tracee(&self, tid: i32) -> TraceeInfo
pub fn tracee(&self, tid: i32) -> TraceeInfo
Returns a copy of what is known about the process of thread tid.
Sourcepub fn set_exe(&self, tid: i32, guest: Vec<u8>, host: Vec<u8>)
pub fn set_exe(&self, tid: i32, guest: Vec<u8>, host: Vec<u8>)
Records the executable the process of thread tid is now running.
Sourcepub fn ids(&self, tid: i32) -> Ids
pub fn ids(&self, tid: i32) -> Ids
The virtual identity of the process of thread tid (root until changed).
Sourcepub fn set_ids(&self, tid: i32, ids: Ids)
pub fn set_ids(&self, tid: i32, ids: Ids)
Replaces the virtual identity of the process of thread tid.
Sourcepub fn dumpable(&self, tid: i32) -> bool
pub fn dumpable(&self, tid: i32) -> bool
Whether the process of thread tid still reads as dumpable.
Sourcepub fn set_dumpable(&self, tid: i32, dumpable: bool)
pub fn set_dumpable(&self, tid: i32, dumpable: bool)
Records the dumpable flag the process of thread tid set.
Sourcepub fn groups(&self, tid: i32) -> Option<Vec<u32>>
pub fn groups(&self, tid: i32) -> Option<Vec<u32>>
Supplementary groups of the process of thread tid, if setgroups was called.
Sourcepub fn set_groups(&self, tid: i32, groups: Vec<u32>)
pub fn set_groups(&self, tid: i32, groups: Vec<u32>)
Records the supplementary groups of the process of thread tid.