1

When I check a process which can use over 10000 file descriptors, lsof only shows 4 digit. (that is it can only show 9999)

When over 10000, it start with a asterisk sign. For example:

COMMAND   PID USER   FD   TYPE    DEVICE SIZE/OFF      NODE NAME
a.out     29944 root 9995u  IPv6 846704101      0t0       TCP 192.168.1.1:rtsp->192.168.1.2:50609 (ESTABLISHED)
a.out     29944 root 9996u  IPv6 846706748      0t0       TCP 192.168.1.1:rtsp->192.168.1.3:50634 (ESTABLISHED)
a.out     29944 root 9997u  IPv6 846708259      0t0       TCP 192.168.1.1:rtsp->192.168.1.4:50657 (ESTABLISHED)
a.out     29944 root *000u  IPv6 846710907      0t0       TCP 192.168.1.1:rtsp->192.168.1.5:50682 (ESTABLISHED)
a.out     29944 root *002u  IPv6 846714817      0t0       TCP 192.168.1.1:rtsp->192.168.1.6:50732 (ESTABLISHED)
a.out     29944 root *003u  IPv6 846720366      0t0       TCP 192.168.1.1:rtsp->192.168.1.5:50763 (ESTABLISHED)
a.out     29944 root *004u  IPv6 846722078      0t0       TCP 192.168.1.1:rtsp->192.168.1.6:50785 (ESTABLISHED)
a.out     29944 root *005u  IPv6 846735778      0t0       TCP 192.168.1.1:rtsp->192.168.1.6:50905 (ESTABLISHED)
a.out     29944 root *006u  IPv6 846736777      0t0       TCP 192.168.1.1:rtsp->192.168.1.16:50930 (CLOSE_WAIT)

How can I get more information (more digits)?

Or what command can I use to collect all file descriptors of a process?

neoesque
  • 11
  • 3

1 Answers1

1

Since I were running into a somehow similar problem, I wanted to share my findings here too. I did some research regarding Custom lsof output and found that

lsof's internal formatting options are quite restrictive ...

However, after reading in the manpage about OUTPUT, OUTPUT FOR OTHER PROGRAMS and in other discussions I've learned how to exclude certian types of file descriptors (FD), i.e.

lsof -u ${USER} -a -d "^mem,^cwd,^rtd,^txt"

or how to limit the lsof output to just numeric FDs, i.e.

lsof -u ${USER} -a -d "0-999999"

To list only numeric FDs for a specific process ID (PID) and for further processing in an other program I've used the following approach

lsof -p ${PID} -a -d "0-999999" -Ff

I haven't created and test it for bigger numbers of FDs yet, but maybe it helps collect all descriptors you are interested in.

U880D
  • 597
  • 7
  • 17