crosvm/sys_util
Allen Webb 5e185834fc sys_util: Add scoped_signal_handler.
This adds a scoped signal handler struct that performs some basic checks
to avoid accidental replacement of an existing handler and cleanup when
the handler goes out of scope.

Also, adds scoped_signal_handler::wait_for_interrupt() which blocks
until SIGINT is received (e.g. via Ctrl-C).

BUG=None
TEST=cargo test --workspace -- --test-threads=1

Change-Id: I5e649eac3d3ee0b842b200fc553acac44b2dfe94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2807306
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
2021-04-16 18:04:32 +00:00
..
poll_token_derive
src sys_util: Add scoped_signal_handler. 2021-04-16 18:04:32 +00:00
.build_test_serial
Cargo.toml sys_util: add tool for raw descriptor reflection 2021-03-29 19:39:51 +00:00