Russ Allbery wrote:
Steve Langasek <[EMAIL PROTECTED]> writes:
On Sun, Nov 11, 2007 at 09:25:11PM +0100, Arthur de Jong wrote:
This seems to be quite common code (from one of my packages (cvsd),
don't know what the original source for this code was):
m=sysconf(_SC_OPEN_MAX);
for (i=0;i<m;i++)
close(i);
There are hurd packages for this package so that should also work.
I wouldn't be so quick to assume that sysconf(_SC_OPEN_MAX) does anything
useful on Hurd at runtime.
Plus, I suppose making 65,000 pointless system calls during the startup of
a daemon (not a particularly surprising value for the limit on open file
descriptors) isn't really that big of a deal, but it feels kind of "ugh"
to me. If every daemon does that, I wonder if it would have a noticable
impact on startup speed. Probably not, since in Linux system calls are
pretty fast, but that's a large multiplicative factor.
Is there no way of listing open file handles within a process? It seems
like there should be a better way. If the kernel knows what file handles
exist (and lsof can get the info) then what's stopping a process from
accessing that information directly? Maybe it's just not portable enough?
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]