c语言捕获kill信号_如何在Linux上的C语言中捕获Kill发出的信号

c语言捕获kill信号

Programs may want to catch the kill signals sent by the kill command in C programs on Linux so that it can gracefully shutdown itself before it is killed. For example, I have a daemon progd running, and it may be killed by pkill progd. The progd may want to save some in-memory state to disks because otherwise that data will be lost. The question is how to catch the signal sent by the kill command and response to it in the programs implemented in C on Linux?

程序可能希望捕获Linux上C程序中kill命令发送的kill信号,以便它可以在杀死之前正常关闭自己。 例如,我正在运行一个守护进程progd,它可能会被

你可能感兴趣的:(信号处理,linux,java,c语言,ubuntu)