gpt4 book ai didi

c - ubuntu 上的信号处理 C 编程

转载 作者:行者123 更新时间:2023-11-30 20:10:21 27 4
gpt4 key购买 nike

当我向 ubuntu 上的程序发送 kill -9 命令时,我想在程序关闭之前关闭其他正在运行的进程。我正在使用 C 编程尝试此操作。会不会是这样的?如果你收到 KILL 命令,我怎么能说程序应该做一些事情呢?

最佳答案

the POSIX standard <signal.h> documentation :

...

The following signals shall be supported on all implementations (default actions are explained below the table):

Signal   Default Action  Description
....
SIGKILL T Kill (cannot be caught or ignored).

请注意“不能被捕获或忽略”。

您的进程永远不会“看到”SIGKILL,因为操作系统只是在没有任何通知的情况下终止该进程。

关于c - ubuntu 上的信号处理 C 编程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46286186/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com