mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Ulrich Drepper <drepper@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: Fw: sigwait() breaks when straced
Date: Mon,  1 Aug 2005 00:57:04 -0700 (PDT)	[thread overview]
Message-ID: <20050801075704.D5120180EC0@magilla.sf.frob.com> (raw)
In-Reply-To: Ulrich Drepper's message of  Monday, 1 August 2005 00:09:53 -0700 <a36005b50508010009453fdfb7@mail.gmail.com>

> But sigwait is not a function specified with an EINTR error number. 
> As I said before, this does not mean that EINTR cannot be returned. 
> But it will create havoc among programs and it causes undefined
> behavior wrt to SA_RESTART.  I think it is best to not have any
> function for which EINTR is not a defined error to fail this way. 
> This causes the least amount of surprises and unnecessary loops around
> the userlevel call sites.

We use the same rt_sigtimedwait system call for sigtimedwait and
sigwaitinfo, which do list EINTR for the case of a handled signal.
It's for this scenario that the system call gives EINTR in this case.
We could have libc's sigwait repeat the system call on EINTR.

Unfortunately it is already the case that stop signals cause signal
interruption of system calls when they should be restarted.
rt_sigtimedwait is no different from other system calls in this regard.
It's a general problem.  There is a signal wakeup in order to process the
stop signal.  The blocking system call wakes up diagnoses this with EINTR.
In the case of a handled signal, this gets to the handler setup and the
first thing that does is the SA_RESTART processing.  But when the signal
instead causes a stop (for job control or ptrace) and a later resumption
without running a signal handler, no restart happens.  In the case of the
sleep calls, this causes early wakeups.  In other blocks it produces the
spurious EINTR returns.



Thanks,
Roland

      reply	other threads:[~2005-08-01  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050730170049.6df9e39f.akpm@osdl.org>
2005-08-01  0:01 ` Roland McGrath
2005-08-01  0:12   ` Dave Airlie
2005-08-01 16:25     ` Jesper Juhl
2005-08-01 19:20       ` Ulrich Drepper
2005-08-01  7:09   ` Ulrich Drepper
2005-08-01  7:57     ` Roland McGrath [this message]

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=20050801075704.D5120180EC0@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=drepper@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome