Skip to content

Conversation

jhriggs
Copy link

@jhriggs jhriggs commented May 13, 2020

  • Adds a mapping of signal numbers to signal names based on the "most common" (subjective) signals.
  • This allows the same config/script to be used on different platforms, for example: -r TERM:QUIT (15:3 on Linux vs. 25:20 on OS X).
  • Each entry is wrapped in a #ifdef SIG<NAME>/#endif pair in an attempt to make this implementation as portable as possible.
  • Names can be specified with or without the SIG prefix, and numbers and names can be used in any combination: -r 15:3, -r TERM:QUIT, -r SIGTERM:3, -r TERM:SIGQUIT, etc.
  • Corresponding signum_to_signame() and signame_to_signum() functions were added.
  • A new -l/--list option shows the mapping in use on the current system/platform/OS.
  • Debug output has been updated to include the signal name along with the number.

Fixes #87.

The build of the signal map is a bit lanky in dumb-init.c due to all of the #ifdef/#endif. It may be worth moving it into a separate file and using externs and #includes, but I kept everything together for this first stab at it.

- Adds a mapping of signal numbers to signal names based on the "most common" (subjective) signals.
- This allows the same config/script to be used on different platforms, for example: -r TERM:QUIT (15:3 on Linux vs. 25:20 on OS X).
- Each entry is wrapped in a #ifdef SIG<NAME>/#endif pair in an attempt to make this implementation as portable as possible.
- Names can be specified with or without the SIG prefix, and numbers and names can be used in any combination: -r 15:3, -r TERM:QUIT, -r SIGTERM:3, -r TERM:SIGQUIT, etc.
- Corresponding signum_to_signame() and signame_to_signum() functions were added.
- A new -l/--list option shows the mapping in use on the current system/platform/OS.
- Debug output has been updated to include the signal name along with the number.

Fixes Yelp#87.
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

Successfully merging this pull request may close these issues.

Allow specifying signal names for --rewrite
1 participant