linux - 哪些系统调用不会被信号中断?

标签 linux unix linux-kernel kernel signals

据我所知,linux/unix 上的大多数系统调用在收到信号时都会中断。根据下面的博文,有一些系统调用没有被中断:

In general function that return immediately (don't wait for any I/O operation to complete or sleep) are not interruptible like socket(2) which just allocates a socket and doesn't wait for anything.

http://www.linuxprogrammingblog.com/all-about-linux-signals?page=5

是否有这些函数的列表?任何与此主题相关的链接都会有所帮助。

最佳答案

What is the mechanism that kernel uses to decide which call is interruptible and which one is not? (if the story with "socket()" is true)

任务有位掩码,可以用set_task_state设置到 TASK_INTERRUPTIBLETASK_UNINTERRUPTIBLE(定义 here)。

Is there a list of those kind of functions?

我不认为存在不间断函数列表。您可以搜索 TASK_UNINTERRUPTIBLE 的用法(例如 this)

编辑:examplesignal_pending_state 检查这个标志

关于linux - 哪些系统调用不会被信号中断?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35085178/

相关文章:

unix - 如何使用 Unix 命令行工具将文件的行按 100 行 block 进行打乱?

linux - 互斥解锁和 request_module() 行为

c - 共享变量的多处理竞赛

linux - Bash:字符串操作在空格处终止

linux - 为什么 Apache 不允许从 index.html 中访问 Web 根目录之外的文件?

c++ - 多次调用 madvise

linux - 如何测试自己的 Linux 模块?

linux - 内核控制路径和内核线程之间有什么关系?

linux - 匹配 bash case 语句中的字符串并查找当前无线网络

linux - 确保 XMODEM 忠实传输文件