Add an initcall to handle system shutdown. This serves the purpose of
cleaning up process resources, and returning the application's exit
status back to Unikraft.
The implementation varies depending on system configuration. When
multithreading is not enabled, the handler simply returns the exit
status of the application. When multithreading or multiprocess are
enabled, the handler sends a SIGTERM to the appliation and blocks until
the application returns. It then proceeds to forcefully terminate any
remaining process. When signals are not enabled the implementation falls
back into forceful termination.
Signed-off-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1633