From: Jesper Juhl <jesper.juhl@gmail.com>
To: Dave Airlie <airlied@gmail.com>
Cc: Roland McGrath <roland@redhat.com>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, Ulrich Drepper <drepper@gmail.com>
Subject: Re: Fw: sigwait() breaks when straced
Date: Mon, 1 Aug 2005 18:25:00 +0200 [thread overview]
Message-ID: <9a87484905080109257abd0bde@mail.gmail.com> (raw)
In-Reply-To: <21d7e99705073117121241159a@mail.gmail.com>
On 8/1/05, Dave Airlie <airlied@gmail.com> wrote:
> >
> > However, there is in fact no bug here. The test program is just wrong.
> > sigwait returns zero or an error number, as POSIX specifies. Conversely,
> > sigtimedwait and sigwaitinfo either return 0 or set errno and return -1.
> > It is odd that the interfaces of related functions differ in this way,
> > but they do.
>
> The someone should fix the manpage, it explicitly says
> "The sigwait function never returns an error."
>
> Which is clearly wrong if it can return EINTR...
>
As I read SUSv3 , sigwait /can/ return error, but EINTR is not one
that it's supposed to ever return.
>From http://www.opengroup.org/onlinepubs/009695399/functions/sigwait.html :
...
ERRORS
The sigwait() function may fail if:
[EINVAL]
The set argument contains an invalid or unsupported signal number.
...
EINVAL is the only defined error for sigwait.
Also, at the start of the thread Ulrich Drepper said "The kernel
simply doesn't restart the function in case of a signal. It should do
this, though." .
I'm not quite sure you are right Ulrich. Given this little bit from
SUSv3 about SA_RESTART in the page describing sigaction (
http://www.opengroup.org/onlinepubs/009695399/functions/sigaction.html
) :
...
SA_RESTART
This flag affects the behavior of interruptible functions; that
is, those specified to fail with errno set to [EINTR]. If set, and a
function specified as interruptible is interrupted by this signal, the
function shall restart and shall not fail with [EINTR] unless
otherwise specified. If the flag is not set, interruptible functions
interrupted by this signal shall fail with errno set to [EINTR].
...
by that definition, that interruptible functions are those "specified
to fail with errno set to [EINTR]", I don't see how sigwait can be
considered an interruptible function since it
a) doesn't set errno
b) doesn't even list EINTR as a defined error return
And if sigwait is not an interruptible function, then how would it be
correct for the kernel to restart it ?
Also, the sigwait page (linked above) also says that "The sigwait()
function shall select a pending signal from set, atomically clear it
from the system's set of pending signals, and return that signal
number in the location referenced by sig." - the word that stands out
to me here is "atomically" - how can it be atomic if it is allowed to
be interrupted by signals?
What am I missing?
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
next prev parent reply other threads:[~2005-08-01 16:28 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 ` Fw: sigwait() breaks when straced Roland McGrath
2005-08-01 0:12 ` Dave Airlie
2005-08-01 16:25 ` Jesper Juhl [this message]
2005-08-01 19:20 ` Ulrich Drepper
2005-08-01 7:09 ` Ulrich Drepper
2005-08-01 7:57 ` Roland McGrath
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=9a87484905080109257abd0bde@mail.gmail.com \
--to=jesper.juhl@gmail.com \
--cc=airlied@gmail.com \
--cc=akpm@osdl.org \
--cc=drepper@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox