create_init_child_process

Function create_init_child_process 

Source
pub fn create_init_child_process<L>(
    locked: &mut Locked<L>,
    kernel: &Arc<Kernel>,
    initial_name: TaskCommand,
    seclabel: Option<&CString>,
) -> Result<TaskBuilder, Errno>
Expand description

Create a process that is a child of the init process.

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

Most processes are created by userspace and are descendants of the init process. In some situations, the kernel needs to create a process itself. This function is the preferred way of creating an actual userspace process because making the process a child of init means that init is responsible for waiting on the process when it dies and thereby cleaning up its zombie.

If you just need a kernel task, and not an entire userspace process, consider using create_system_task instead. Even better, consider using the kthreads threadpool.

If seclabel is set, or the container specified a default_seclabel, then it will be resolved against the kernel’s active security policy, and applied to the new task. Otherwise the task will inherit its LSM state from the “init” task.

This function creates an underlying Zircon process to host the new task.