Atoptool / atop

System and process monitor for Linux
GNU General Public License v2.0
789 stars 110 forks source link

Collect nropen for each process to monitor if fd leaks #218

Open ShirleyFei opened 1 year ago

ShirleyFei commented 1 year ago

This patch collects and displays the current number of opened file descriptors for each process to monitor if fd leaks. As each thread has the same fds with its process, there is no need to collect each thread's fd numbers then.

Considering users may set the nr_open limit to a very large number, we use getdents[64] SYSCALL directly to get fd numbers instead of glibc's readdir() for performance consideration.

Also, define MAX_OPEN to be 1024 1024 for display even if the fd numbers may exceed 1024 1024.

Signed-off-by: Fei Li lifei.shirley@bytedance.com