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