Setting up signal masks in a Linux C daemon

馋奶兔 提交于 2019-12-06 08:08:50

The libc documentation states:

Each process has its own signal mask. When you create a new process (see Creating a Process), it inherits its parent’s mask.

So the answer to why is the blocked mask different is because the parents used to have different masks...

Your given C code adds some signals to the block list since you use sigprocmask with the first parameter set to SIG_BLOCK. If you want to overwrite the signal mask, use SIG_SETMASK. With that, you should end up with a parent independent signal block mask.

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