[Vm-dev] Interrupted system call?

Ian Piumarta piumarta at speakeasy.net
Wed Feb 11 19:43:07 UTC 2009

On Feb 11, 2009, at 1:56 AM, Andrew Gaylard wrote:

> Ian: I assume you mean this:
> http://www.stanford.edu/~stinson/cs240/cs240_1/WIB.txt


> - it does not specify that system calls should be restarted.
> - it does not re-instate the handler (i.e. it assumes that kernel  
> will).
> - it does not in every case do the manual check for EINTR and restart,
> as John mentioned in his post.
> My approach is to fix the former two, thus avoiding having to fix the
> latter.

Setting SA_RESTART does not guarantee that the kernel can (or even  
should) restart the call transparently; e.g., select() and poll()  
return EINTR even if the intervening signal has the restart flag  
set.  Section 10.5 of Advanced Programming in the UNIX Environment  
(Stevens and Rago) explains quantitatively some issues in handling  
EINTR, has a table of the behaviours supported among a few flavours  
of Unix, and mentions a few inconsistencies.  The sections on context  
switching and interrupts in The Design of the Unix Operating System  
(Bach) explain qualitatively the pragmatic choice in Unix to always  
save the post-syscall user mode PC rather than trying to roll back  
partially-completed calls when necessary.


More information about the Vm-dev mailing list