pub fn trace(
cmd: Vec<&str>,
conf: &mut TracerConf,
runtime_conf: &RuntimeConf<'_>,
) -> Result<ProcessList, String>Expand description
Main syswall tracing function: allows a child process to be executed and traced by syswall
When called, the current process will fork and the child will execute cmd. The parent will
then enter the trace loop which processes the syscalls for the child (tracee) process. When
the child process terminates, this function will return.
§Arguments
cmd: command and arguments used for running the child process (e.g. [“ls”, “-l”])conf:TracerConfinstance which will be used and modified during the traceruntime_conf:RuntimeConfinstance which provides details of the runtime interface
§Returns
Upon success, returns an Ok(ProcessList) containing the states of all tracee processes.
§Example
use syswall::trace;
use syswall::tracer_conf::{RuntimeConf, TracerConf};
let cmd = vec!["ls", "-l"];
let mut conf = TracerConf::default();
let runtime_conf = RuntimeConf::default();
if let Ok(process_states) = trace(cmd, &mut conf, &runtime_conf) {
// Handle final process status reports
}