public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* paccept() oddity
@ 2008-08-20 16:50 Michael Kerrisk
  2008-08-29 20:45 ` Michael Kerrisk
  2008-09-10 18:10 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Kerrisk @ 2008-08-20 16:50 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Davide Libenzi, Andrew Morton, lkml, Linus Torvalds

Ulrich,

[
2.6.27-rc has paccept():

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

While considering the sigset argument for paccept() (see my previous
message), and testing that system call, I realized that there is a certain
oddness in the implementation of paccept().

Like accept(), paccept() automatically restarts if interrupted by a signal
handler that was established with the SA_RESTART flag.

On the other hand, pselect(), ppoll(), and epoll_pwait() are never restarted
if interrupted by a handler, even if the handler was established with
SA_RESTART.  (This is the same as with select(), poll(), and epoll_wait().)

It seems to me that it makes little sense to restart paccept(), especially in
the case where it is interrupted by a handler for one of the signals that is
in sigmask, since the whole point of calling paccept() is to block until a
connection is received, or until one of the signals in sigmask is caught().

How about changing paccept() so that it is never automatically restarted if
interrupted by a signal handler, regardless of the SA_RESTART flag.  (In
other words, paccept() should be consistent with pselect(), ppoll(), and
epoll_pwait(), rather than being consistent with accept().)  What are your
thoughts?

Cheers,

Michael


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-11  5:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-20 16:50 paccept() oddity 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox