I have a (C, Linux) application which handles Ctrl-C SIGINT by shutting down. I'd like to add another signal handler so that I can use another keystroke combo for "reload configuration while running".
So I'm looking from a signal I can send to the foreground process by keystroke, which doesn't force the process to quit or suspend. Are there any others?
Ctrl-C. Pressing this key causes the system to send an INT signal ( SIGINT ) to the running process. By default, this signal causes the process to immediately terminate.
By default, when a console window has the keyboard focus, CTRL + C or CTRL + BREAK is treated as a signal (SIGINT or SIGBREAK) and not as keyboard input.
If You press Ctrl-D then the terminal driver will send a SIGINT to the signal handler of the program. Note: pressing VINTR will erase the terminal input buffer so You can not read the characters typed in the line before the VINTR key pressed.
You can use ctrl+Z
,
SIGTSTP
Value = 20
For more details refer this link.
You can try Ctrl - \
which is SIGQUIT
if you absolutely need it to be a keystroke (you can catch it).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With