Re: lsof and the FD column



M.Garneau wrote:
Hi

 Suppose I'm typing the command
lsof -p 15231
and I get
COMMAND  PID   USER  FD   TYPE  DEVICE   SIZE  NODE      NAME
[...]
prog1          15231  mgar  20w   REG     3,2         1617   5537892
/home/mgar/files/file1
prog1          15231  mgar  21w   REG     3,2         1617   5537892
/home/mgar/files/file1
prog1          15231  mgar  22w   REG     3,2          1617  5537892
/home/mgar/files/file1
[...]

 what's the interpretation of this concerning the FD column? It sounds
strange that 'file1' would be open for output (write mode) 3 times
within the same process, so what else could it be? To me the FD number
may represent many things if I try to understand what MAN gives; file
handle, or library reference (?), but what doe it mean concretelly?


in my eyes it is not that strange. Each file descriptor has its own offset into the file, so it might make sense to open a single file multiple times.

BTW: lsof is not a Solaris board utility. I would like to recommend the
use of pfiles and pmap instead. Maybe the output of those tools will
give you the information you are looking for.

HTH,
Tom
.