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

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Joerg



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