I'm trying to find out total number of currently open file descriptors (or any file related objects) on current OS.
My current betting is sysctl
(3), and I think kern.num_files
does the job. But I'm not actually sure what it means, and I can't find any manual page entry or standard spec for kern.num_files
. This makes me nervous.
kern.num_files
is listed onman 3 sysctl
, but only names are listed and says nothing about what it actually means.- Command line
sysctl -a
(2) lists and report some value forkern.num_files
. sysctl.h
does not define a name looks likekern.num_files
although it even contains names likeKERN_FILE
that are considers private/deprecated.
Is this actually the count of system-wide open FD? Where can I find any spec for this?
If kern.num_files
is not the number, what is recommended way to get the total open FD count?