shi*_*kou 10
根据man 7 signal
,
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
Run Code Online (Sandbox Code Playgroud)
他说的是真的,你无法抓住SIGKILL和SIGSTOP
#include <stdio.h>
#include <signal.h>
void funCatch(int signal)
{
printf("sucessfully caught the kill signal\n");
}
int main(int argc,char **argv)
{
if(signal(SIGKILL,funCatch)==SIG_ERR)
{
printf("cannot catch signal\n");
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是验证上述语句的示例代码.