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.
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