get number of open files in a process?

Fernando Apesteguía fernando.apesteguia at gmail.com
Thu Jan 21 15:51:55 UTC 2016


On Thu, Jan 21, 2016 at 4:36 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> 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.

I don't have a FreeBSD box in front of me right now, but don't we have
this information in the sysctl tree? I remember we have the current
system-wide open fd's...

Cheers.

>
> Joerg
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"


More information about the freebsd-hackers mailing list