Skip to main content

reparent_children

Function reparent_children 

Source
fn reparent_children(
    sched: &mut GlobalSchedState,
    identity: &mut SchedIdentity,
    dying: TaskId,
) -> Option<usize>
Expand description

Performs the reparent children operation. Reparent children of a dying task to PID 1 (init), or drop parent links if PID 1 is not available.

ยงOrphan policy

  • PID 1 exists: Orphans are reparented to init, which is responsible for reaping them. This matches standard Unix semantics.
  • PID 1 does not exist: Parent links are dropped entirely. Orphans become parentless : they continue running but cannot be wait()-ed on. This avoids the nondeterministic fallback of adopting an arbitrary task (which might be short-lived or unsuitable for reaping).
  • PID 1 is the dying task: Same as above : parent links are dropped.