[Vm-dev] Interrupted system call?

Andrew Gaylard ag at computer.org
Wed Feb 11 06:10:50 UTC 2009


On Wed, Feb 11, 2009 at 4:38 AM, Ian Piumarta <piumarta at speakeasy.net> wrote:

> The pragmatically correct way to deal with this is to wrap each and every
> syscall in a Unix program in sometime like this:
>
> while (EINTR == (err= syscall(whatever, ...)));
> if (err) { deal with it }
>
> The philosophically correct way to deal with it is to use an OS that isn't
> Unix.

Another pragmatically correct way to deal with it is to make use of
restartable syscalls, so that when signals arrive, the handler is called,
and when it completes the syscall resumes.  This is done when installing
the signal handler,  by using sigaction instead of signal, and by setting
the SA_RESTART flag.

As luck would have it, I'm busy investigating changing squeak to this
model at the moment, having had problems with platforms which
clear the handler after the first signal, and require to be reinstalled.

Andrew


More information about the Vm-dev mailing list