nix
nix copied to clipboard
Added `sigaction_is_default()`, `sigaction_is_ignore()`, and `sigaction_current()` functions
trafficstars
What does this PR do
Provide safe mechanisms to determine whether a signal's action is the default or ignore.
This covers the majority of real-world calls to sigaction() with a NULL action without needing any unsafe code.
Provide an unsafe way to query the currently installed sigaction.
The decision to add sigaction_current() instead of just exposing the (new) sigaction_inner() function was to avoid any confusion over the semantics of passing in a None sigaction argument (eg: someone thinking that it meant remove or reset the action).
This closes #2172
Checklist:
- [x] I have read
CONTRIBUTING.md - [x] I have written necessary tests and rustdoc comments
- [x] A change log has been added if this PR modifies nix's API
I've also added a (loosely) related/complementary proposal to add safe functions to ignore and restore signals' actions in #2191.