From 2d263bc3fc81289c4f360713ee899d323eed9879 Mon Sep 17 00:00:00 2001 From: Paul Kunysch <kunysch@me.com> Date: Wed, 6 Mar 2013 00:15:46 +0100 Subject: [PATCH] Process: Increase FD_SETSIZE on Cygwin The Single UNIX (R) Specification, Version 2 defines "FD_SETSIZE", but does not specify the effects if it's (re)defined by an application. Cygwin's newlib headers document that FD_SETSIZE may be defined by the user [1] and should be >= NOFILE. [2] Setting it to 16384 uses a value from Cygwin's poll() implementation. [3] [1]: http://cygwin.com/cgi-bin/cvsweb.cgi/src/newlib/libc/include/sys/types.h?cvsroot=src [2]: http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/include/sys/param.h?cvsroot=src [3]: http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/poll.cc?cvsroot=src Change-Id: Idc43fc28a398979da1e9289e1080a9fc1090c605 --- ProcessUNIX.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ProcessUNIX.c b/ProcessUNIX.c index fc9e8bf6..b9af2f1f 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -47,6 +47,12 @@ do. */ +#if defined(__CYGWIN__) +/* Increase the file descriptor limit for select() before including + related system headers. (Default: 64) */ +# define FD_SETSIZE 16384 +#endif + #include <stddef.h> /* ptrdiff_t */ #include <stdio.h> /* snprintf */ #include <stdlib.h> /* malloc, free */ -- GitLab