From: Peter Kjellerstedt Date: Thu, 27 May 2010 15:17:54 GMT Subject: RE: [PATCH] compat: Add another rudimentary poll() emulation Message-ID: In-Reply-To: > -----Original Message----- > From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On > Behalf Of Erik Faye-Lund > Sent: den 27 maj 2010 16:44 > To: Marko Kreen > Cc: Jonathan Nieder; Jonathan Callen; git@vger.kernel.org; > mduft@gentoo.org; Sverre Rabbelier; Michael J Gruber; Johannes Sixt; > msysGit > Subject: Re: [PATCH] compat: Add another rudimentary poll() emulation > > On Thu, May 27, 2010 at 4:32 PM, Marko Kreen wrote: [cut] > > Ah, ok.  I though this is the nfds for select().  In this case it can > > still fail, as nfds=1 for poll() can still go over FD_SETSIZE for > > select() if the fd value is big enough.  On non-windows, that is. > > I don't quite get where one would get a fd that's value is FD_SETSIZE > or above from. I mean, FD_SETSIZE would have to be the maximum value > of a file descriptor, or else you risk open() or socket() returning > file descriptors that cannot be select()'ed. Which would just be > insane, no? > > -- > Erik "kusma" Faye-Lund That is exactly how e.g. Linux works. If your application can have more than 1024 file descriptors open simultaneously, you are restricted to use poll() as you risk having a file descriptor with a value >= 1024. And using FD_SET() with a file descriptor >= 1024 will trash memory... //Peter