From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Roland McGrath" <roland@redhat.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Ulrich Drepper" <drepper@redhat.com>,
"Davide Libenzi" <davidel@xmailserver.org>,
lkml <linux-kernel@vger.kernel.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Oleg Nesterov" <oleg@tv-sign.ru>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: paccept() oddity
Date: Thu, 11 Sep 2008 07:47:00 +0200 [thread overview]
Message-ID: <cfd18e0f0809102247h677acc76r9c76994cdf036443@mail.gmail.com> (raw)
In-Reply-To: <20080911003833.265E7154210@magilla.localdomain>
Roland,
Thanks for having a look at this.
On 9/11/08, Roland McGrath <roland@redhat.com> wrote:
> I don't see any rationale for changing paccept to be an oddball special
> case in its EINTR behavior.
>
> select/poll are special cases historically, and that's why the principle of
> least astonishment makes it best for pselect/ppoll to match their behavior.
I agree on the idea of least astonishment. I just differ on where
greater astonishment is considered to lie. If I'm making a system
call one of whose arguments is a mask of signals that the system call
should wait for, then I expect the system call to return, rather than
restart, if that signal is delivered, regardless of SA_RESTART. This
is the behaviour of pselect(), which seems perfectly reasonable, and
happens to coincide with historical select() EINTR behavior.
But, perhaps all of this is moot, given the point you raise below (and
which I already raised with Ulrich)...
> The same principle makes it highly dubious to have paccept differ from
> accept in such a subtlety. I don't see any reason to want it, anyway.
> An application that wants to see EINTR can just use sigaction to clear
> SA_RESTART.
>
> Frankly, I don't see the rationale for rolling the implicit sigprocmask
> into paccept at all. accept is analogous to read or other i/o calls,
> not to select/poll.
That is precisely the other point about paccept() that I've already
raised, which drew no response from Ulrich:
http://thread.gmane.org/gmane.linux.kernel/723952/focus=728786
(I'll add you to the CC on that thread.)
> It's not any normal plan to fiddle blocked signals
> around a blocking i/o call. Instead, programs use (p)select/poll (and
> sometimes also O_NONBLOCK) to manage the blocking and waking up. Then
> when the program finally calls accept, it knows it won't block. The
> atomic signal machinery makes sense for pselect/ppoll to help manage the
> corner cases of blocking/wakeup in event loops. It makes no more sense
> to roll blocked signal set changes into accept than it would to have
> read, write, etc. all take a sigset_t and do that.
Agreed.
Given that adding a sigset to accept():
* seems unnecessary (i.e., it provides no functionality that we can't
get otherwise), * is inconsistent with other I/O APIs that don't have
a sigset argument (e.g., read(), write(), redvfrom(), open(), etc.)
* currently (IMO) provides questionable semantics around EINTR
I'd argue in favour of eliminating this syscall in favour of a simpler:
accept4(int fd, struct sockaddr *sa, socklen_t *salen, ind flags);
and in the meantime disabling sys_paccept() in -rc.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html
prev parent reply other threads:[~2008-09-11 5:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 16:50 Michael Kerrisk
2008-08-29 20:45 ` Michael Kerrisk
2008-09-08 13:31 ` Michael Kerrisk
2008-09-10 18:10 ` Andrew Morton
2008-09-11 0:38 ` Roland McGrath
2008-09-11 5:47 ` Michael Kerrisk [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=cfd18e0f0809102247h677acc76r9c76994cdf036443@mail.gmail.com \
--to=mtk.manpages@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=davidel@xmailserver.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=oleg@tv-sign.ru \
--cc=roland@redhat.com \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®