nix icon indicating copy to clipboard operation
nix copied to clipboard

Mechanism to query existing signal handler

Open cpick opened this issue 2 years ago • 2 comments
trafficstars

If NULL is passed as the second (new action) argument to sigaction(), then it won't make any changes, but will return the existing action.

I don't believe nix provides any way to access this behavior. The type of nix::sys::signal::sigaction()s sigaction argument could be changed from &SigAction to Option<&SigAction>, but this would be a breaking change and also would mean doing a read-only query of the current action would only be possible with an unsafe function call.

I'd prefer something like a safe sigaction_get() (roughly akin to this proposal for a sigaction_safe()).

cpick avatar Oct 20 '23 22:10 cpick

Could you suggest a complete API, or better yet post a PR?

asomers avatar Nov 11 '23 18:11 asomers

Could you suggest a complete API, or better yet post a PR?

Sure thing.

I've opened #2190 with my suggested implementation.

cpick avatar Nov 14 '23 01:11 cpick