Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Dec 2014 09:32:23 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [RFC] EINTR and PC loser-ing library design

On Mon, Dec 08, 2014 at 03:29:53PM +0100, Laurent Bercot wrote:
> On 08/12/2014 15:10, Rich Felker wrote:
> 
> >I don't see what problem you're trying to solve. EINTR does not happen
> >unless you intentionally request it by setting up an interrupting
> >signal handler, using sigaction() with the SA_RESTART flag clear.
> 
>  What about SIGSTOP, and its cousins SIGTSTP, SIGTTIN and SIGTTOU ?
>  Even when you don't request anything, you can receive them. They
> stop the process, they don't kill it. What happens when the process
> resumes, if it was interrupted in the middle of an interruptible
> system call ?

The system call restarts (or, formally, it's as if it were never
interrupted; EINTR only applies to signal _handlers_).

> >Retry-on-EINTR loops are generally misguided unless they're in code
> >that's intended to be using in programs which use interrupting signal
> >handlers, but which need to reliably complete an operation even if
> >interrupted.
> 
>  And that happens all the time in asynchronous event loops where you
> handle signals with a self-pipe. ;)

Only if you have installed interrupting signal handlers.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.