lsof -u apache | wc -l で出てくるのはちょっと違う。
ていうかulimitの値超えてるし。


なので、下記コマンドをroot権限で/procから実行する感じ。(誤差アリアリ)

ls -l `ps auxwww|grep httpd|awk '{print $2}'|sort -u|sed "s/$/\/fd/"`|grep '\->'|wc -l

root権限じゃないと実行できないので、充分注意してください。
場所が場所だけに、一つ間違えるとぶっ壊れるんじゃないかと。

ってそもそもこんなことやる奴居ないか。。




参考にしたサイト:

GNU/Linux - How Many Open Files?
What is an open file?

Is an open file a file that is being used, or is it an open file descriptor? A file descriptor is a data structure used by a program to get a handle on a file, the most well know being 0,1,2 for standard in, standard out, and standard error. The file-max kernel parameter refers to open file descriptors, and file-nr gives us the current number of open file descriptors. But lsof lists all open files, including files which are not using file descriptors - such as current working directories, memory mapped library files, and executable text files. To illustrate, let's examine the difference between the output of lsof for a given pid and the file descriptors listed for that pid in /proc.