Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask
From: Oleg Nesterov
Date: Wed Jun 12 2019 - 09:50:51 EST
On 06/11, David Laight wrote:
> If I have an application that has a loop with a pselect call that
> enables SIGINT (without a handler) and, for whatever reason,
> one of the fd is always 'ready' then I'd expect a SIGINT
> (from ^C) to terminate the program.
This was never true.
Before Eric's patches SIGINT can kill a process or not, depending on timing.
In particular, if SIGINT was already pending before pselect() and it finds
an already ready fd, the program won't terminate.
After the Eric's patches SIGINT will only kill the program if pselect() does
not find a ready fd.
And this is much more consistent. Now we can simply say that the signal will
be delivered only if pselect() fails and returns -EINTR. If it doesn't have
a handler the process will be killed, otherwise the handler will be called.