title: In Mac OS X, how can I get an accurate count of file descriptor usage?
body: <p>On Linux, <code>ulimit -n</code> can be used to change or view the limit on the number of file descriptors for a process, and <code>lsof -p nnn | wc -l</code> seems to consistently report the actual file descriptor usage.  </p>
  
  <p>But on Mac OS X, <code>lsof -p nnn | wc -l</code> can return a number higher than the limit.  I suppose this means <code>lsof</code> is returning more than just file descriptors, but I can't tell what's what.</p>
  
  <p>Bottom line: <strong>How can I get an accurate count of file descriptor usage in Mac OS X?</strong></p>