2
如果父进程收到ctrl-C信号,我一直试图阻止父父线程杀死子进程。我已经用完了想法。阻止孩子从父进程中获取SIGINT
父进程已准备好捕获SIGINT,所以我想和现在的孩子一样死。
int main() {
pid_t pid;
pid = fork();
if(pid > 0) {
/*Parent proccess*/
[...other code...]
} else {
/*Child proccess*/
signal(SIGINT, SIG_IGN); //does not work
sigaction(SIGINT, &action, 0); //does not work either
[...other code...]
}
}
想法?
如果父母的流程已经死亡,让孩子活着的目标是什么? – duDE
子进程杀死它的信号是什么? –
[Linux守护进程]的可能重复(http://stackoverflow.com/questions/3095566/linux-daemonize) – ecatmur