wasmer_wasix/syscalls/wasix/
proc_exec.rs

1use wasmer::FromToNativeWasmType;
2
3use super::*;
4use crate::{
5    os::task::{OwnedTaskStatus, TaskStatus},
6    syscalls::*,
7};
8
9/// Replaces the current process with a new process
10///
11/// ## Parameters
12///
13/// * `name` - Name of the process to be spawned
14/// * `args` - List of the arguments to pass the process
15///   (entries are separated by line feeds)
16///
17/// ## Return
18///
19/// Returns a bus process id that can be used to invoke calls
20#[instrument(level = "trace", skip_all, fields(name = field::Empty, %args_len), ret)]
21pub fn proc_exec<M: MemorySize>(
22    mut ctx: FunctionEnvMut<'_, WasiEnv>,
23    name: WasmPtr<u8, M>,
24    name_len: M::Offset,
25    args: WasmPtr<u8, M>,
26    args_len: M::Offset,
27) -> Result<(), WasiError> {
28    proc_exec2(
29        ctx,
30        name,
31        name_len,
32        args,
33        args_len,
34        WasmPtr::null(),
35        M::ZERO,
36    )
37}