rusty_mos::process::envs

Function env_alloc

Source
pub fn env_alloc(parent_id: u32) -> Result<usize, KError>
Expand description

Alloc an env and setup its vm and PCB.

§Return

If there is at least one free env, and the env_setup_vm works well, the raw pointer to the new env will be returned with a Ok wrapper.

Otherwise, a KError with a Err wrapper will be returned if there is no free env (KError::NoFreeEnv) or env_setup_vm fails.

§Safety

The env got in the free list SHALL be valid.