From: Ara.T.Howard@... Date: 2004-08-25T05:45:40+09:00 Subject: Re: Find the number of open files On Wed, 25 Aug 2004, Charles Mills wrote: > On Aug 24, 2004, at 12:41 PM, Charles Mills wrote: > >> Is there an easy way to find out the number of open files held by a >> process (using C or Ruby)? >> > I think the way I phrased the question above makes the problem sound > harder than it is... > I am unittesting a C extension. The extension opens files using > open(). I want to make sure that the extension closes all the files it > opens (when errors occur or whatever). > > So I figured getting a count of open file descriptors before the > extension code is called and after it is finished would enable me to do > this. define an xopen that updates a static var - then you won't have to worry about some other process/thread/function opening up files and killing your test... cheerx. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================