]> xenbits.xensource.com Git - unikraft/unikraft.git/commit
lib/posix-process: Handle system shutdown
authorMichalis Pappas <michalis@unikraft.io>
Mon, 14 Apr 2025 14:33:40 +0000 (16:33 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Wed, 30 Apr 2025 10:07:29 +0000 (10:07 +0000)
commit2f8493c1857d0e9be76ac1c85f66fbf378fa362d
tree7437391ad762ff1be00328d32b38865dc8776437
parent078915278a24a1fb2bdf50d8f81bffd208c51140
lib/posix-process: Handle system shutdown

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
lib/posix-process/Makefile.uk
lib/posix-process/shutdown.c [new file with mode: 0644]