Linux – SIGINFO on GNU Linux (Arch Linux) missing

glibclinuxsignals

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.

My questions are:

  1. Why is SIGINFO missing on my system? Is it absent on all GNU Linux systems?
  2. Is there an easy (i.e. no kernel/glibc recompilation) way to enable this signal? If none, what would be the hard way?
  3. 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)

Linux metainfo:

Linux whatever 3.18.2-2-ARCH #1 SMP PREEMPT Fri Jan 9 07:37:51 CET 2015 x86_64 GNU/Linux

Update: I am still looking for more information as to why this signal is conditionally excluded from other systems than BSD (see comments below). The signal seems to be quite useful for many purposes so it is hard for me to believe it is just a matter of whim – so what's the real showstopper for this signal to be available on Linux?

Best Answer

There was talk (back in the linux 0.x-1.x days) of adding this (because it was useful on BSD systems) but if I recall correctly there were reasons it was harder to do right on Linux than BSD at the time.

Note that what you're asking about is only a small part of the feature (namely, you're talking about an stty info entry for control-T causing the kernel to deliver SIGINFO to the tty's process group) - that part is "easy" - but having the kernel report information about the process status when it doesn't handle the signal (because at the time very few things had any support for that, the feature was mainly about "is this process spinning or hung" and "what process is it anyway") is harder - ISTR there even being security/trust issues about displaying that information accurately, and whether it should be associated with the Secure Attention Key path. That said, there might be some value in the "easy" version that only sends the signal...

(From personal memory; a quick web search doesn't turn up anything obvious but I think one would have to dig into really old archives to find the discussion.)

Related Question