to myself 的分类学习日志

做自己想做的事
posts - 232, comments - 6, trackbacks - 0, articles - 0

linux signal

Posted on 2010-09-30 15:42 kongkongzi 阅读(282) 评论(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);




只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理