问题描述
我是新手,对linux有基本的了解.
I am a newbie and have basic understanding of linux.
每当内核遇到特定进程的信号时,它首先会检查特定进程的进程控制块(PCB)中的信号处理程序表.如果信号处理程序已注册,它将调用该函数.如果标志是SIG_DEFAULT,则它调用在内核的全局信号表中注册的信号处理程序.如果标志是SIG_IGNORE,则内核仅忽略特定进程的信号.
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.
我只想知道进程如何将标志从SIG_DEFAULT更改为SIG_IGNORE.请说明机制(使用系统调用或更改信号表或PCB).下次当再次捕获信号时,内核会执行哪些优化操作.
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.
推荐答案
Call the signal
function. Note that some signals may not be ultimately ignoreable.
这篇关于如何使过程忽略某些信号(例如SIGHUP,SIGABRT,SIGABORT,SIGINT等.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!