信号忽略行为
信号忽略行为
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> int main() { struct sigaction nact, oact; nact.sa_handler = SIG_IGN; // 忽略行为 nact.sa_flags = 0; sigemptyset(&nact.sa_mask); sigaction(SIGINT, &nact, &oact); while (1); return 0; }