Re: How to increse [sic.] max open files?

rdm@tad.micro.umn.edu
7 Jan 1997 21:04:26 -0000


H. Peter Anvin:
> It ain't so easy, and it's BSD's fault. select() has a very nice way
> to ensure that a bitmask of file descriptors is the right size, but
> the FD_* support routines immediately bungles that very nice idea by
> effectively requiring the maximum number of file descriptors
> (technically, the largest possible numerical value of a file
> descriptor) to be known at compile time. There is no way in C to
> implement a compatible interface, and have dynamic allocation,
> although it is possible in C++ by using contructors/destructors.

Not entirely.

First off, you could define a nicer mechanism than FD_* to manipulate
bit sets for select(). This could be FD_* plus size argument, or it
might be something completely different (ordered linked list of
integers?).

Secondly, it's tolerable to define the size at compile time, as long
as it's reasonably obvious how to redefine the size, and reasonably
easy to set the size to something meaningful.

-- 
Raul