EINTR is retried automatically if you use sigaction() and set the SA_RESTART flag.
If you use signal() instead of sigaction() it depends on your OS whether EINTR is automatically retried - never use signal().
(There's a few exceptions still - partial completed syscalls, e.g. a signal can cause read() to return partial data or sleep() to return before it should - neither case gives you EINTR though)
Re:Should you be scared of Unix signals?
by adrianratnapala on Tuesday June 14, 2016 @05:41PM
(#11905558)
Yes, but how does the Plan9 "notify" mechanism help with any of that? It seems to just be a tidied up version of signals, and therefore "needs" to do EINTR in much the same way as Unix.
More on what EINTR is for: http://250bpm.com/blog:12
If you get rid of signals, you wouldn't need EINTR. Even with signals, what people do 99% of the time is just retry the system call immediately. It would probably have been much better to have it do so automatically by default, avoiding exposing EINTR to most users.