Date: Thu, 21 Jan 2016 13:34:18 +0000 From: "Batutis, Ed" <Ed.Batutis@netapp.com> To: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: get number of open files in a process? Message-ID: <ea9f2ab2d4f543c8ad34fdeb082f8c7a@hioexcmbx08-prd.hq.netapp.com>
next in thread | raw e-mail | index | archive | help
Hi,
I need to determine the number of open files in my process - all types of file handles total - sockets, files, everything.
Does this work reliably for that purpose?
int num_open = 0; /* number of open files? */
kinfo_file *inf = kinfo_getfile(getpid(), &num_open);
if ( inf ) {
free(inf);
}
Thanks,
=Ed
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ea9f2ab2d4f543c8ad34fdeb082f8c7a>
