lkml.org 
[lkml]   [2003]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: select() stress
Date
This message uses a character set that is not supported by the Internet
Service. To view the original message content, open the attached message.
If the text doesn't display correctly, save the attachment to disk, and then
open it using a viewer that can display the original character set.
<<message.txt>>
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 <jamie.sparks@cubic.com>
To: DervishD <raul@pleyades.net>
cc: "Richard B. Johnson" <root@chaos.analogic.com>,
Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: select() stress
In-Reply-To: <20030318144632.GB1438@DervishD>
Message-ID: <Pine.WNT.4.44.0303180946120.1424-100000@GOLDENEAGLE.gameday2000>
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<getdtablehi(); i++) close(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
>

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.161 / U:8.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site