Received: from GOLDENEAGLE.gameday2000 (GOLDENEAGLE [149.63.50.78]) by CURLY.ds.cubic.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id CTBWS181; Tue, 18 Mar 2003 06:35:50 -0800 Date: Tue, 18 Mar 2003 09:49:31 -0500 (Eastern Standard Time) From: Jamie Sparks To: DervishD cc: "Richard B. Johnson" , Linux kernel Subject: Re: select() stress In-Reply-To: <20030318144632.GB1438@DervishD> Message-ID: X-X-Sender: sparksj@curly.ds.cubic.com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE I cannot find a posix nor linux implementation of getdtablehi(). To get around it, I do the following: int a =3D open("some_file_I_know_exists",O_RDWR); close(a); then use a as the 1st param to select(). perhaps it ought to be a+1? Jamie On Tue, 18 Mar 2003, DervishD wrote: > Hi Richard, again :) > > In my last message I told you that getdtablesize() is not > reliable for closing all file descriptors, that its return value is > not necessarily related to the file descriptor index. Well, I forgot > to say that getdtablehi() effectively returns the index for the > largest file descriptor available to the process plus one, that is, > perfect for using with 'select()' and for closing all open files: > > for(i=3D0; i > Is this implemented under Linux? I have a piece of software that > relies on the above (now it's written using getdtablesize(), which is > non-correct as you noted) for closing all file descriptors... > > Thanks again for noting this, Richard :) > > Ra=FAl N=FA=F1ez de Arenas Coronado > > -- > Linux Registered User 88736 > http://www.pleyades.net & http://www.pleyades.net/~raulnac >