-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanism to query existing signal handler #2172
Labels
Comments
Could you suggest a complete API, or better yet post a PR? |
cpick
pushed a commit
to cpick/nix
that referenced
this issue
Nov 14, 2023
Provide a way to query the currently installed sigaction. The decision to add `sigaction_current()` instead of just exposing the `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 builds towards nix-rust#2172.
cpick
pushed a commit
to cpick/nix
that referenced
this issue
Nov 14, 2023
Provide a way to query the currently installed sigaction. The decision to add `sigaction_current()` instead of just exposing the `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 builds towards nix-rust#2172.
cpick
pushed a commit
to cpick/nix
that referenced
this issue
Nov 14, 2023
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. Fixes nix-rust#2172.
3 tasks
Sure thing. I've opened #2190 with my suggested implementation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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()
ssigaction
argument could be changed from&SigAction
toOption<&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 anunsafe
function call.I'd prefer something like a safe
sigaction_get()
(roughly akin to this proposal for asigaction_safe()
).The text was updated successfully, but these errors were encountered: