nix icon indicating copy to clipboard operation
nix copied to clipboard

Add sigaction() versions that allow specify the signal by its number

Open ChrysoliteAzalea opened this issue 1 year ago • 4 comments
trafficstars

Currently, the nix::sys::signal::sigaction() function uses the Signal enum, which only covers standard signals, but not real-time signals. Using real-time signals with nix requires using the std::mem::transmute() function to assign an impossible value to the Signal enum, which is undefined behavior.

What does this PR do

In this PR, I add two new functions: nix::sys::signal::sigaction_numeric(), that uses signal numbers instead of the enum, and nix::sys::signal::sigaction_noretrieve(), which also doesn't retrieve the old signal handler by supplying the null pointer as the oldact argument (to avoid trouble if the handler has been installed by the C code).

Checklist:

  • [yes] I have read CONTRIBUTING.md
  • [yes] I have written necessary tests and rustdoc comments
  • [?] A change log has been added if this PR modifies nix's API

ChrysoliteAzalea avatar Jun 15 '24 13:06 ChrysoliteAzalea