From: "Michael Kerrisk" <mtk.manpages@gmail.com>
To: "Davide Libenzi" <davidel@xmailserver.org>
Cc: "Pierre Habouzit" <madcoder@debian.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
mtk/manpages@gmail.com
Subject: Re: epoll and shared fd's
Date: Sat, 26 Jan 2008 08:37:41 +0100 [thread overview]
Message-ID: <517f3f820801252337lcd4b0a0hde7359dc46a947dd@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0801241556130.29058@alien.or.mcafeemobile.com>
On Jan 25, 2008 12:57 AM, Davide Libenzi <davidel@xmailserver.org> wrote:
>
> On Thu, 24 Jan 2008, Pierre Habouzit wrote:
>
> > On Fri, Jan 18, 2008 at 09:10:18PM +0000, Davide Libenzi wrote:
> > > On Fri, 18 Jan 2008, Pierre Habouzit wrote:
> > >
> > > > Hi,
> > > >
> > > > I just came across a strange behavior of epoll that seems to
> > > > contradict the documentation. Here is what happens:
> > > >
> > > > * I have two processes P1 and P2, P1 accept()s connections, and send the
> > > > resulting file descriptors to P2 through a unix socket.
> > > >
> > > > * P2 registers the received socket in his epollfd.
> > > >
> > > > [time passes]
> > > >
> > > > * P2 is done with the socket and closes it
> > > >
> > > > * P2 gets events for the socket again !
> > > >
> > > >
> > > > Though the documentation says that if a process closes a file
> > > > descriptor, it gets unregistered. And yes I'm sure that P2 doens't dup()
> > > > the file descriptor. Though (because of a bug) it was still open in
> > > > P1[0], hence the referenced socket still live at the kernel level.
> > > >
> > > > Of course the userland workaround is to force the EPOLL_CTL_DEL before
> > > > the close, which I now do, but costs me a syscall where I wanted to
> > > > spare one :|
> > >
> > > For epoll, a close is when the kernel file* is released (that is, when all
> > > its instances are gone).
> > > We could put a special handling in filp_close(), but I don't think is a
> > > good idea, and we're better live with the current behaviour.
> >
> > Okay, maybe updating the linux manpages to be more clear about that is
> > the way to go then. Thanks
>
> Sure. I'll send Michael Kerrisk and updated statement for the A6 answer in
> the epoll man page.
Thanks Davide -- yes please send me a patch.
next prev parent reply other threads:[~2008-01-26 7:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 13:43 Pierre Habouzit
2008-01-18 21:10 ` Davide Libenzi
2008-01-24 8:40 ` Pierre Habouzit
2008-01-24 23:57 ` Davide Libenzi
2008-01-26 7:37 ` Michael Kerrisk [this message]
[not found] ` <Pine.LNX.4.64.0801261308270.10472@alien.or.mcafeemobile.com>
2008-02-26 15:13 ` Michael Kerrisk
2008-02-26 19:04 ` Davide Libenzi
2008-02-26 19:14 ` Michael Kerrisk
2008-02-26 19:31 ` Davide Libenzi
[not found] <9MZLT-1YO-33@gated-at.bofh.it>
[not found] ` <9N6Ng-5tn-21@gated-at.bofh.it>
[not found] ` <9P5WE-33i-11@gated-at.bofh.it>
[not found] ` <9Pk9l-1KA-1@gated-at.bofh.it>
[not found] ` <9PNNZ-b0-5@gated-at.bofh.it>
[not found] ` <a19Lb-1F0-13@gated-at.bofh.it>
[not found] ` <a19Lb-1F0-11@gated-at.bofh.it>
2008-02-26 18:16 ` Bodo Eggert
2008-02-28 12:10 ` Michael Kerrisk
2008-02-28 19:17 ` Bodo Eggert
2008-02-28 19:30 ` Davide Libenzi
2008-02-28 13:53 ` Valdis.Kletnieks
2008-02-28 15:08 ` Michael Kerrisk
2008-02-28 19:27 ` Davide Libenzi
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=517f3f820801252337lcd4b0a0hde7359dc46a947dd@mail.gmail.com \
--to=mtk.manpages@gmail.com \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madcoder@debian.org \
--cc=mtk/manpages@gmail.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
all inboxes | Powered by JetHome®