Cygwin FD_SETSIZE issues

Vernon Schryver vjs@calcite.rhyolite.com
Thu Jun 10 15:33:49 UTC 2004


> From: "Christian Becker" 

> dccifd currently segfaults on Cygwin because it defines FD_SETSIZE as only
> 64 - with EXTRA_FILES evaluating to 72, this leads to a malloc(-1) on line
> 378 which kill the corresponding memset two lines further.
> getrlimit boundaries aren't hit, thus max_work/max_max_work aren't adjusted.
> This is fairly easy to fix, just wonder what would be the cleanest
> solution - for example, conditionally redefining FD_SETSIZE to 1024 would
> do - though a quick research on the web suggests that ancient Windows
> 98/ME can practically have something around 100 files open but I guess
> this isn't worth worrying about.

I don't know how many files Windows 98/ME can handle, but some years ago
I found that the Winsock 2 in 98/ME croaks at around 100 TCP/IP sockets.
FD_SETSIZE=64 seems rather small.  Does the Cygwin implementation of
select() assume that 64-bit type for the bit masks?


As far as the DCC source is concerned, I think the right fix is twofold:

  - detect max_max_work<=0, complain, and clamp it to 1.

  - let NUM_CWFS, the number of per-user whitelist file control structures,
   be controlled with the ./configure script.  It is currently set to 20,
   which is too many on a system tiny FD_SETSIZE values.
   MAX(2, MIN(20, FD_SETSIZE-32)) seems fair.


Vernon Schryver    vjs@rhyolite.com



More information about the DCC mailing list

Contact vjs@rhyolite.com by mail or use the form.