Allow system call restarts upon signal interruption
The X server frequently deals with SIGIO and SIGALRM interruptions. If process execution is inside certain blocking system calls when these signals arrive, e.g. with the kernel blocked on a contended semaphore, the system calls will be interrupted. Some system calls are automatically restartable (the kernel re-executes them with the same parameters once the signal handler returns) but only if the signal handler allows it. Set SA_RESTART on the signal handlers to enable this convenient behaviour. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Daniel Drake <drake@endlessm.com>
This commit is contained in:
parent
58d54ee82d
commit
94ab7455ab
@ -178,7 +178,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure)
|
|||||||
}
|
}
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sigaddset(&sa.sa_mask, SIGIO);
|
sigaddset(&sa.sa_mask, SIGIO);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = SA_RESTART;
|
||||||
sa.sa_handler = xf86SIGIO;
|
sa.sa_handler = xf86SIGIO;
|
||||||
sigaction(SIGIO, &sa, &osa);
|
sigaction(SIGIO, &sa, &osa);
|
||||||
xf86SigIOFuncs[i].fd = fd;
|
xf86SigIOFuncs[i].fd = fd;
|
||||||
|
@ -1255,6 +1255,7 @@ SmartScheduleInit(void)
|
|||||||
memset((char *) &act, 0, sizeof(struct sigaction));
|
memset((char *) &act, 0, sizeof(struct sigaction));
|
||||||
|
|
||||||
/* Set up the timer signal function */
|
/* Set up the timer signal function */
|
||||||
|
act.sa_flags = SA_RESTART;
|
||||||
act.sa_handler = SmartScheduleTimer;
|
act.sa_handler = SmartScheduleTimer;
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
sigaddset(&act.sa_mask, SIGALRM);
|
sigaddset(&act.sa_mask, SIGALRM);
|
||||||
|
Loading…
Reference in New Issue
Block a user