1

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 on man 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 for kern.num_files.
  • sysctl.h does not define a name looks like kern.num_files although it even contains names like KERN_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?

eonil
  • 83,476
  • 81
  • 317
  • 516
  • Have you looked at this: https://apple.stackexchange.com/questions/33715/which-command-controls-the-open-file-limits – olha Jul 13 '20 at 07:19
  • 1
    @Olha It seems your link is about "max limit" value. I'm looking for "current open files descriptor count". Thanks anyway. – eonil Jul 13 '20 at 07:25

0 Answers0