c++signalskillcoredump

C++ program that catches SIGKILL under Linux


I want to create a coredump when my process receives the SIGKILL in linux. I try to catch this signal, but it seems that SIGKILL can't be caught.


Solution

  • That is correct, As per the man page for sigaction:

    signum specifies the signal and can be any valid signal except SIGKILL and SIGSTOP.

    This has pretty much been the case forever, you really don't want to give a process the ability to handle all signals since that would allow you to get to a point where it can only be killed by a power cycle :-)