create_init_process

Function create_init_process 

Source
pub fn create_init_process(
    locked: &mut Locked<Unlocked>,
    kernel: &Arc<Kernel>,
    pid: pid_t,
    initial_name: TaskCommand,
    fs: Arc<FsContext>,
    rlimits: &[(Resource, u64)],
) -> Result<TaskBuilder, Errno>
Expand description

Creates the initial process for a kernel.

The created process will be a task that is the leader of a new thread group.

The init process is special because it’s the root of the parent/child relationship between tasks. If a task dies, the init process is ultimately responsible for waiting on that task and removing it from the zombie list.

It’s possible for the kernel to create tasks whose ultimate parent isn’t init, but such tasks cannot be created by userspace directly.

This function should only be called as part of booting a kernel instance. To create a process after the kernel has already booted, consider create_init_child_process or create_system_task.

The process created by this function should always have pid 1. We require the caller to pass the pid as an argument to clarify that it’s the callers responsibility to determine the pid for the process.