Skip to content
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

Translate signal numbers to user-friendly strings #80

Open
vorner opened this issue Jan 3, 2021 · 0 comments
Open

Translate signal numbers to user-friendly strings #80

vorner opened this issue Jan 3, 2021 · 0 comments

Comments

@vorner
Copy link
Owner

vorner commented Jan 3, 2021

Signal hook uses the low-level c_int to represent signal numbers, because signal numbers are somehow "open" enum ‒ it's not clear what signals might be available on whatever platform someone compiles signal-hook on, or if they are having a custom kernel patch for their embedded device.

But if one wants to present the signal to the user (maybe in the logs, or something), printing the number is not the most user-friendly thing one can do. It would be nice if:

  • We had some way to convert that to user-friendly name (either having an enum with TryFrom<c_int> on it, or some kind of fn(c_int) -> &str function)
  • Debug outputs of various things (especially the Origin) would do this conversion.

❓ If we decide to go with that enum type, should our API generally accept that in addition to raw c_int, in the form of Into<c_int>, or the like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant