Print an kernel error rather than panicing if init(8) exits abnormally.

This avoids the misimpression that a kernel bug happened and it avoids
clearing the screen of potentially useful information about an init(8)
crash.
This commit is contained in:
Jonas 'Sortie' Termansen 2017-05-21 22:20:28 +02:00
parent ceff78b6b6
commit 9f9f4d4e3f
3 changed files with 12 additions and 4 deletions

View File

@ -218,10 +218,12 @@ graphics resolution (see
.Sh EXIT STATUS
.Nm
exits 0 if the kernel should power off, exits 1 if the kernel should reboot, or
exits 2 if the boot failed and the kernel should halt.
exits 2 if the boot failed and the kernel should halt with a complaint about an
.Nm
fatality.
Any other exit by the initial
.Nm
will trigger a kernel panic.
will cause the kernel to halt with a complaint about an unexpected exit code.
.Nm
exits with the same exit status as its target session if it terminates normally.
.Sh SEE ALSO

View File

@ -666,7 +666,10 @@ static void BootThread(void* /*user*/)
Log::Sync();
HaltKernel();
default:
PanicF("Init returned with unexpected return code %i", status);
Log::PrintF("kernel: fatal: init exited with unexpected exit code %i\n",
status);
Log::Sync();
HaltKernel();
}
}

View File

@ -39,7 +39,10 @@ delimiter to stop kernel option parsing.
The computer is powered off if the
.Nm init
process exits 0, rebooted if it exits 1,
halted if it exits 2, and paniced otherwise.
halted with an complaint about an
.Nm init
fatality if it exits 2, and halted with a complaint about an unexpected exit code
otherwise.
.Pp
The options are as follows:
.Bl -tag -width "12345678"