I am developing an application and I would like it to print some runtime stats to the console on demand. kill
and signals came to my mind immediately.
Reading through Unix signals on Wiki, SIGINFO
seems like the way to go because:
- It is intended for these purposes
- Does not terminate the process if the signal handler is not implemented (contrary to
SIGUSRx
- see here)
However, by inspecting the output of kill -l
, it seems my server does not have this signal implemented. Yet I am quite sure that when I ctrl+T on a running dd
, it does print some stats about it.
My questions are:
- Why is
SIGINFO
missing on my server? - Is there an easy (i.e. no kernel/glibc recompilation) way to enable this signal? If none, what would be the hard way?
- What alternative signal could I use for my purposes that would not cause any side-effects if not handled by the target process? (I already assume none since I could not find any other suitable signal on the glibc's manual)
- (Optional, but really interested in) What signal does
dd
receive (and responds to) when I press ctrl+T? Is there a way I could identify such signal without knowing it beforehand?
Linux metainfo:
Linux whatever 3.18.2-2-ARCH #1 SMP PREEMPT Fri Jan 9 07:37:51 CET 2015 x86_64 GNU/Linux
Aucun commentaire:
Enregistrer un commentaire