Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What keyboard signal apart from Ctrl-C can I catch?

Tags:

c

linux

signals

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?

like image 370
blueshift Avatar asked Mar 30 '12 06:03

blueshift


People also ask

Which signal is generated with Ctrl-C?

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.

Is Ctrl-C the same as SIGINT?

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.

Does Ctrl d send a signal?

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.


2 Answers

You can use ctrl+Z,

SIGTSTP 

Value = 20

For more details refer this link.

like image 173
Anantha Krishnan Avatar answered Sep 28 '22 15:09

Anantha Krishnan


You can try Ctrl - \ which is SIGQUIT if you absolutely need it to be a keystroke (you can catch it).

like image 39
cnicutar Avatar answered Sep 28 '22 14:09

cnicutar