From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [RFC] EINTR and PC loser-ing library design
Date: Mon, 8 Dec 2014 10:09:54 -0500 [thread overview]
Message-ID: <20141208150954.GE4574@brightrain.aerifal.cx> (raw)
In-Reply-To: <20141208150031.GD4574@brightrain.aerifal.cx>
On Mon, Dec 08, 2014 at 10:00:31AM -0500, Rich Felker wrote:
> On Mon, Dec 08, 2014 at 03:45:33PM +0100, Laurent Bercot wrote:
> > On 08/12/2014 15:32, Rich Felker wrote:
> >
> > >The system call restarts (or, formally, it's as if it were never
> > >interrupted; EINTR only applies to signal _handlers_).
> >
> > Could you please provide a pointer to the specification that
> > guarantees this ? I've never been able to find a normative text that
> > ensures you will never get EINTR unless you explicitly install a
> > signal handler without SA_RESTART.
>
> I've had a hard time pinning it down too, but that's what all modern
> (e.g. modern enough to have a working sigaction) implementations do,
> and it's the obviously correct behavior. I would consider making a
> request for clarification here, but after what happened with the C
> locale issue, I'd kinda fear some trolls would appear and insist that
> EINTR be allowed to happen for no good reason. :(
The closest I can find is XSH 2.4.4 Signal Effects on Other Functions:
Signals affect the behavior of certain functions defined by this
volume of POSIX.1-2008 if delivered to a process while it is
executing such a function. If the action of the signal is to
terminate the process, the process shall be terminated and the
function shall not return. If the action of the signal is to stop
the process, the process shall stop until continued or terminated.
Generation of a SIGCONT signal for the process shall cause the
process to be continued, and the original function shall continue
at the point the process was stopped. If the action of the signal
is to invoke a signal-catching function, the signal-catching
function shall be invoked; in this case the original function is
said to be "interrupted" by the signal. If the signal-catching
function executes a return statement, the behavior of the
interrupted function shall be as described individually for that
function, except as noted for unsafe functions. Signals that are
ignored shall not affect the behavior of any function; signals
that are blocked shall not affect the behavior of any function
until they are unblocked and then delivered, except as specified
for the sigpending() and sigwait() functions.
The above text seems to be what defines the concept of "interrupted",
and it's in terms of a "signal-catching function". The behavior "as
described individually for that function" is usually to fail with
EINTR, but it's overridden by the text of the sigaction function which
defines SA_RESTART to automatically restart functions interrupted in
this sense.
Rich
next prev parent reply other threads:[~2014-12-08 15:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <esmoarexomn.wl-danny.milo+a@gmail.com>
2014-12-08 14:04 ` dannym
2014-12-08 14:10 ` Rich Felker
2014-12-08 14:29 ` Laurent Bercot
2014-12-08 14:32 ` Rich Felker
2014-12-08 14:45 ` Laurent Bercot
2014-12-08 15:00 ` Rich Felker
2014-12-08 15:09 ` Rich Felker [this message]
2014-12-08 15:18 ` dannym
2014-12-08 15:28 ` Rich Felker
2014-12-08 15:49 ` Laurent Bercot
2014-12-08 16:00 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141208150954.GE4574@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).