feat: react to guest shutdown events (graceful shutdown, guest side) - #15
Open
Anamika1608 wants to merge 6 commits into
Open
Anamika1608 wants to merge 6 commits into
Anamika1608 wants to merge 6 commits into
Conversation
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Signed-off-by: Anamika Aggarwal <anamikaagg18@gmail.com>
Anamika1608
marked this pull request as ready for review
August 11, 2026 19:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
How it works
/dev/input/event*that reportsKEY_POWER). QEMU and Cloud Hypervisor deliver a power-button press this way.signalfdforSIGCHLD,SIGINTandSIGTERM, and callsreboot(CAD_OFF)so a guest Ctrl+Alt+Del (Firecracker on x86) arrives asSIGINTto PID 1.pollloop that reaps children and watches for a shutdown event.SIGTERMto the app's process group once, then keeps waiting for the app to exit./devand mounts devtmpfs at start, because the guest initrd has none.Design choices
SIGTERMand time to exit. The container manager'sSIGKILLis the outer bound. This matches the host side.reboot(RESTART). On QEMU (-no-reboot) this is a clean stop.SIGINTpath keeps working.Status
CONFIG_INPUT_EVDEV,CONFIG_GPIO_PL061,CONFIG_KEYBOARD_GPIO), so the power button never reaches userspace. A guest kernel with these options is needed to test the full path.Testing
staticandstatic_debugunder the strict flags (-Werror -Wextra -Wall -pedantic-errors).