While executing system call, If signal occurs, then kernel take one of the two actions,
1) If a signal arrived while we were executing kernel code, then just before returning from the system call we first call the user program's signal handler, and when this finishes return from the system call.
2) When a system call is slow and a signal arrives while it was blocked,
waiting for something, the call is aborted and returns -EINTR,
so that the library function will return -1 and set errorno
to
EINTR.Just before the system call returns, the user program's
signal handler is called.
In second case, I am not understanding that why not system call execution is restarted by default, once handler get executed? I know that can be
automated by installing the signal handler using a call to sigaction with the SA_RESTART
flag set, but why not it is default?
Shyam.