diff options
author | Daniel Drake <drake@endlessm.com> | 2015-05-12 16:39:22 -0600 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-10-26 12:18:21 -0400 |
commit | f92c0b9f94deaa03f792c3c93efd802fec268e8f (patch) | |
tree | a0d01e64116aa2b3e97d07fed7712545a6cc9bd7 | |
parent | d2e4a9d4ac2f479de23e15af5e528cfa2bffb30f (diff) | |
download | xserver-f92c0b9f94deaa03f792c3c93efd802fec268e8f.tar.gz |
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>
(cherry picked from commit 94ab7455abc213fc96760e29ab2e943ec682fb22)
-rw-r--r-- | hw/xfree86/os-support/shared/sigio.c | 2 | ||||
-rw-r--r-- | os/utils.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c index 45949f7a3..c746d02fc 100644 --- a/hw/xfree86/os-support/shared/sigio.c +++ b/hw/xfree86/os-support/shared/sigio.c @@ -178,7 +178,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) } sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, SIGIO); - sa.sa_flags = 0; + sa.sa_flags = SA_RESTART; sa.sa_handler = xf86SIGIO; sigaction(SIGIO, &sa, &osa); xf86SigIOFuncs[i].fd = fd; diff --git a/os/utils.c b/os/utils.c index 74d73b305..881d173e3 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1220,6 +1220,7 @@ SmartScheduleInit(void) memset((char *) &act, 0, sizeof(struct sigaction)); /* Set up the timer signal function */ + act.sa_flags = SA_RESTART; act.sa_handler = SmartScheduleTimer; sigemptyset(&act.sa_mask); sigaddset(&act.sa_mask, SIGALRM); |