fixup! Add init groups.

This commit is contained in:
Jonas 'Sortie' Termansen 2024-06-18 23:23:36 +02:00
parent b9c49648c4
commit c6c285a414
2 changed files with 13 additions and 4 deletions

View file

@ -223,11 +223,20 @@ void Process::OnLastThreadExit()
// Forbid any more processes and threads from being created, so this
// loop will always terminate.
is_init_exiting = true;
for ( Process* process = initfirst; process;
process = process->initnext )
Process* process = firstchild;
while ( process )
{
if ( process->pid != 0 && process != this )
if ( process->pid != 0 )
process->DeliverSignal(SIGKILL);
if ( process->init == process )
process->is_init_exiting = true;
if ( process->firstchild )
process = process->firstchild;
while ( process && process != this && !process->nextsibling )
process = process->parent;
if ( process == this )
break;
process = process->nextsibling;
}
// NotifyChildExit always signals zombiecond for init when
// is_init_exiting is true.

View file

@ -27,7 +27,7 @@ or the current process if
.Fa pid
is zero.
.Pp
Orphaned descendant processes are reparanted to their init process.
Orphaned descendant processes are reparented to their init process.
If an init process exits, all descendant processes atomically receive the
.Dv SIGKILL
signal and become unable to create new processes and threads.