How to make the process ignore some signal(like SIGHUP,SIGABRT,SIGABORT,SIGINT etc..)

末鹿安然 提交于 2019-12-24 12:01:30

问题


I am a newbie and have basic understanding of linux.

Whenever the kernel encounters a signal for a particular process, first it checks the signal handler table in the process control block(PCB) of the particular process. If the signal handler is registered it calls the function. if the flag is SIG_DEFAULT then it calls the signal handler registered in the global signal table of kernel. If the flag is SIG_IGNORE then kernel just ignores the signal for the particular process.

All signals have default signal handlers already registered in signal table by kernel.

I just want to know how a process can change the flag from SIG_DEFAULT TO SIG_IGNORE. Please explain the mechanism(either using system call or changes in the signal table or PCB). Next time when the signal is again captured what optimizations does the kernel do.


回答1:


Call the signal function. Note that some signals may not be ultimately ignoreable.



来源:https://stackoverflow.com/questions/18551485/how-to-make-the-process-ignore-some-signallike-sighup-sigabrt-sigabort-sigint-e

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!