[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <72e07794bcba476f9cad948df2723362@AcuMS.aculab.com>
Date: Tue, 28 May 2019 09:02:32 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Deepa Dinamani' <deepa.kernel@...il.com>,
Oleg Nesterov <oleg@...hat.com>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
"Arnd Bergmann" <arnd@...db.de>, "dbueso@...e.de" <dbueso@...e.de>,
"axboe@...nel.dk" <axboe@...nel.dk>,
Davidlohr Bueso <dave@...olabs.net>, Eric Wong <e@...24.org>,
Jason Baron <jbaron@...mai.com>,
"Linux FS-devel Mailing List" <linux-fsdevel@...r.kernel.org>,
linux-aio <linux-aio@...ck.org>,
Omar Kilani <omar.kilani@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH v2] signal: Adjust error codes according to
restore_user_sigmask()
From: Deepa Dinamani
> Sent: 24 May 2019 18:02
...
> Maybe a crude userspace application could do something like this:
>
> sig_handler()
> {
> set global abort = 1
> }
>
> poll_the_fds()
> {
> ret = epoll_pwait()
> if (ret)
> return ret
> if (abort)
> // but this abort should be ignored if ret was 0.
> return try_again
>
> }
As an application writer I'd want to see 'abort == 1' even
if epoll_pwait() returned that an fd was 'ready'.
So the code above should probably be:
wait_again:
ret = epoll_pwait();
if (abort)
process_abort();
if (ret <= 0) {
if (ret == 0)
process_timeout();
if (ret == 0 || errno == EINTR)
goto wait_again;
// Something went horribly wrong in epoll_pwait()
return ret;
}
// process the 'ready' fds
It would be non-unreasonable for the application to have
all signals blocked except during the epoll_pwait().
So the application needs the signal handler for SIG_INT (etc)
to be called even if one of the fd is always 'ready'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists