Date: Thu, 21 Jan 2016 16:51:53 +0100 From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= <fernando.apesteguia@gmail.com> To: "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: <CAGwOe2Zdjkc0DdkW11SvpyR7zDsAGNToanfE1RggtrbgRww-nA@mail.gmail.com> In-Reply-To: <20160121153636.GA10961@britannica.bec.de> References: <ea9f2ab2d4f543c8ad34fdeb082f8c7a@hioexcmbx08-prd.hq.netapp.com> <20160121153636.GA10961@britannica.bec.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 21, 2016 at 4:36 PM, Joerg Sonnenberger <joerg@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@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGwOe2Zdjkc0DdkW11SvpyR7zDsAGNToanfE1RggtrbgRww-nA>