[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0706101142400.24939@alien.or.mcafeemobile.com>
Date: Sun, 10 Jun 2007 12:16:34 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Paul Mackerras <paulus@...ba.org>
cc: Kyle Moffett <mrmacman_g4@....com>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Theodore Tso <tytso@....edu>,
Ulrich Drepper <drepper@...hat.com>,
Eric Dumazet <dada1@...mosbay.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [patch 7/8] fdmap v2 - implement sys_socket2
On Sun, 10 Jun 2007, Paul Mackerras wrote:
> > for (i = 0; i < NR_OPEN; i++)
> > if (!fd_is_special_to_us(i))
> > close(i);
> >
> > Note that this is conceptually buggy, but occurs in several major C
> > programming books, most of the major shells, and a lot of other
> > software to boot.
>
> Buggy in what way? In the use of the NR_OPEN constant?
That is buggy because the code assumes it is the only owner of the fd
space. Thing that is not true if runtimes have opened their own file
descriptors to handle their own links to the kernel.
The syslog case is kinda bogus. For certain things, you can afford a retry
policy (assuming somone else did not open another fd over the fd that you
cached - then it's gonna be fun). It is crappy, but it *may* work. Sure
is, does not fit any definition of "reliable" I'm aware of.
Think about a runtime that had an epoll fd open and a few fds dropped into
it to, say, deliver some sort of events to the application. After the
Close Loop of Death, the whole thing is gone.
As is, runtimes cannot reliably use (cached) fds for their own internal
communication with the kernel. That, I think we can agree it is a fact.
We can then say that we do not care if runtimes cannot reliably use fds,
and move on. But it's hard to say that the problem does not exist.
- Davide
-
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