Increasing FD_SETSIZE
Marco Stornelli
marco.stornelli@gmail.com
Fri Oct 5 16:01:00 GMT 2012
Il 30/09/2012 10:32, Marco Stornelli ha scritto:
> Hi all,
>
> I need to increase the FD_SETSIZE value from 1024 to 4096. I know it'd
> be better to use poll()/epoll() but I want to understand what are
> pros/cons. The main question is: have I to recompile glibc? I read
> several thread where the change of .h after changing FD_SETSIZE works
> recompiling only the user application. Reading the glibc code (and the
> kernel too), actually it seems to me that if I want to use select(),
> FD_* macro and so on, I have to recompile all because the size of fd_set
> is changed. At this point I have to recompile *all* not only my
> application because if in the system there is an another "common"
> application that uses select and friends, I could have problem. Am I right?
>
> Thanks,
>
> Marco
Hi all,
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.
Regards,
Marco
More information about the Libc-help
mailing list