Skip to content
Advertisement

Which system calls are not interrupted by a signal?

AFAIK, most of the system calls on linux/unix are interrupted when a signal is received. According to the blog post below, there are some system calls that are not interrupted:

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

Is there a list of those kind of functions? Any links related to this topic would be helpful.

Advertisement

Answer

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)

The task have bitmask, which can be set with set_task_state to TASK_INTERRUPTIBLE and TASK_UNINTERRUPTIBLE ( defined here ).

Is there a list of those kind of functions?

I don’t think, that there is list of uninterruptible functions. You can search for usages of TASK_UNINTERRUPTIBLE ( like this )

Edit: example of checking this flag with signal_pending_state

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement