Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2016 17:25:27 +0100
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        Diane Bruce <db@db.net>
Cc:        "Batutis, Ed" <Ed.Batutis@netapp.com>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: get number of open files in a process?
Message-ID:  <20160121162527.GA11600@britannica.bec.de>
In-Reply-To: <20160121161637.GA83843@night.db.net>
References:  <ea9f2ab2d4f543c8ad34fdeb082f8c7a@hioexcmbx08-prd.hq.netapp.com> <20160121153636.GA10961@britannica.bec.de> <20160121161637.GA83843@night.db.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 21, 2016 at 11:16:37AM -0500, Diane Bruce wrote:
> On Thu, Jan 21, 2016 at 04:36:36PM +0100, Joerg Sonnenberger wrote:
> > On Thu, Jan 21, 2016 at 01:34:18PM +0000, Batutis, Ed wrote:
> > > I need to determine the number of open files in my process - all types of file handles total - sockets, files, everything.
> > 
> > Use getdtablesize() to get the current largest known fd. If you want,
> > you can afterwards loop and use fcntl with F_GETFD to check if the
> > descriptor is still open.
> 
> Better off using getrlimit(2)

I don't think the current process limit has any direct relation to the
maximal open file descriptor.

Joerg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160121162527.GA11600>