Increasing FD_SETSIZE
Florian Weimer
fweimer@redhat.com
Mon Oct 8 07:49:00 GMT 2012
On 10/05/2012 05:55 PM, Marco Stornelli wrote:
> after a search I understood the trick. FD_SIZE, FD_ZERO and so on are
> macro and not function (your application won't call an external
> library), so if you change __FD_SETSIZE you are changing the size of
> fd_set and when you compile your application everything it's ok. Glibc
> uses poll when needed so no problem. From kernel point of view there is
> no problem because it uses the first paramenter of select and then the
> max fds per-process, there isn't a problem to handle a bigger struct
> fd_set. So at the end, in your development environment you need to
> change .h and in your target environment you need to do uname -n 4096. A
> problem can happen I think, if in this condition, you try to run your
> application on a system with uname -n 1024.
From the glibc side, it will work, but if there's other library code
which uses select for I/O multiplexing (parts of Qt, for example),
you'll have to make sure that there's enough room in the sub-1024
descriptor space (fcntl(F_DUPFD) is good for this task, older Squid
versions should contain example code).
--
Florian Weimer / Red Hat Product Security Team
More information about the Libc-help
mailing list