From: Albert Dvornik Date: Thu, 27 May 2010 13:43:32 GMT Subject: Re: [msysGit] Re: [PATCH] compat: Add another rudimentary poll() emulation Message-ID: In-Reply-To: On Thu, May 27, 2010 at 8:57 AM, Erik Faye-Lund wrote: > On Thu, May 27, 2010 at 2:36 PM, Marko Kreen wrote: [...] >> Hm, good catch.  Seems such compat poll() cannot be done without >> OS-specific hacks. >> > > Perhaps getrlimit() could overridden to return FD_SETSIZE for both the > soft and hard limit when asking about RLIMIT_NOFILE? In such cases, > anyone who passes nfds above FD_SETSIZE hasn't consulted > RLIMIT_NOFILE, and should be outside the standard. But your point > might have been about a limitless poll()-implementation, like the code > you linked tried to achieve. In that context, no. I doubt it's > possible to do in a robust fashion. This is getting far off-topic, but I do think it's possible to do in a robust fashion if you are willing to sacrifice some performance [i.e. we should not consider this for Git =) ], by creating multiple fd_set structures and only shoving up to FD_SETSIZE descriptors into each. Cycling between the structures would cause some extra latency and a LOT more code complexity, but it should work. --bert