get number of open files in a process?

Joerg Sonnenberger joerg at britannica.bec.de
Thu Jan 21 15:36:42 UTC 2016


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


More information about the freebsd-hackers mailing list