Posted on 2010-09-30 15:42
kongkongzi 阅读(293)
评论(0) 编辑 收藏 引用 所属分类:
linux programming
void sig_handler(int signo);
struct sigaction sact;
sigemptyset(&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = &sig_handler;
// for handle crash
sigaction(SIGSEGV, &sact, NULL);
sigaction(SIGABRT, &sact, NULL);
sigaction(SIGBUS, &sact, NULL);
// for handle kill
sigaction(SIGINT, &sact, NULL);
sigaction(SIGTSTP, &sact, NULL);
sigaction(SIGTERM, &sact, NULL);