[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5dr6okgvuq.fsf@Hurtta06k.keh.iki.fi>
Date: 10 Jun 2007 09:35:41 +0300
From: Kari Hurtta <hurtta+gmane@...lo.fmi.fi>
To: linux-kernel@...r.kernel.org
Subject: Re: [patch 7/8] fdmap v2 - implement sys_socket2
Linus Torvalds <torvalds@...ux-foundation.org> writes in gmane.linux.kernel:
<...>
> But let's say that you want to do a library that does name resolution, and
> you actually want to create the socket that binds to the DNS server just
> once, and then re-use that socket across library calls. It's not that the
> library is a thread of its own - it's not - but with the normal linear fd
> space it really cannot do this. Sure, it could try to hide it up somewhere
> in high fd space, but that would slow down other operations, and there's
> no way to guarantee it doesn't clash with some _other_ library doing the
> same thing, so it really isn't a good idea.
>
> Now, when you do a DNS query, the setup cost of opening the socket is the
> least of your worries, so the above example is not a very good one. I'm
> really just giving it as a concrete example of a _conceptual_ problem,
> where some other library really had more pressing performance reasons why
> they cannot keep re-opening a file descriptor and closing it each time.
>
> So _that_ is the kind of situation where I think "anonymous file
> descriptors" make sense.
>
> Linus
Real world example is nss_ldap / pam_ldap -- these needs open socket to
ldap server. That socket is cached. And because they can not trust that
application does not have closed file description of them, they check it with
getpeername + getsockname (at least it did when I looked code on
some years ago.)
( opening socket again includes using starttls and authentication .. so it is
quite some overhead )
/ Kari Hurtta
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists