linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Kerrisk <mtk.manpages@googlemail.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Davide Libenzi <davidel@xmailserver.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Rationale for paccept() sigset argument?
Date: Wed, 20 Aug 2008 18:50:12 +0200	[thread overview]
Message-ID: <48AC4B44.2010606@gmail.com> (raw)

Ulrich,

I'll need to cover this point in the man pages, and the rationale still isn't
clear to me, so I'll check it with you...

2.6.27-rc has paccept():

int paccept(int fd, struct sockaddr *sockaddr, socklen_t *addrlen,
         const sigset_t *sigmask, int setsize, int flags)

paccept() blocks until either a connection is received on fd, or a signal is
sigmask() is caught.

What is the rationale for the sigset argument of paccept()?

For pselect()/ppoll()/epoll_pwait(), the sigset argument allows us to deal
with a not uncommon situation: waiting for both signals and (multiple) file
descriptors.  (The alternative is the self-pipe trick, which requires more
programming effort.)

However, do we really need this argument for paccept()?  I ask this for the
following reasons:

* This seems to be special casing for accept().  But there are other system
calls (e.g., open(), connect(), recvfrom()) that are similar, in the sense
that they may wait on a file descriptor, for which there is no [perceived
need for a] sigset argument.

* It seems to me that any case where we might want to use paccept() could be
equivalently dealt with using the existing pselect()/ppoll()/epoll_pwait()
followed by a conventional accept() if the listening file descriptor
indicates as ready.  (But perhaps I missed something?)

Can you please explain why we need this special case for [p]accept()?

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


             reply	other threads:[~2008-08-20 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 16:50 Michael Kerrisk [this message]
2008-08-29 20:45 ` Rationale for paccept() sigset argument? Michael Kerrisk
2008-09-02  0:48 ` Ulrich Drepper
2008-09-02  7:58   ` Michael Kerrisk
2008-09-08 13:33     ` Michael Kerrisk
2008-09-11  5:48     ` Michael Kerrisk

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=48AC4B44.2010606@gmail.com \
    --to=mtk.manpages@googlemail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=drepper@redhat.com \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).