3
lsof -i :80
COMMAND     PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
gnome-pan 28597 murat   18u  IPv4 2907888      0t0  TCP ....
gnome-pan 28597 murat   19u  IPv4 2907903      0t0  TCP ....
dropbox   28624 murat   18u  IPv4 2755213      0t0  TCP ...

When i list open files with -i switch i found out that some processes have the same fd's.For example above output, 28597 and 28624 pid's have the same fd's.That means these process can reach the same memory space.What is the reason for this ? How can they reach the same area and why ? Also what's the meaning of u (18u) ? Some fd's are end up with w.

ish
  • 138,666
  • 36
  • 303
  • 312
myildirim
  • 221
  • 5
  • 13

2 Answers2

3

That means these process can reach the same memory space.

Why would they want to reach a common memory space? The answer's simple -- to talk to each other!

In your case, dropbox is talking to gnome-panel, which provides the Dropbox status icon.

The libc manual has this to say:

The major use of duplicating a file descriptor is to implement redirection of input or output: that is, to change the file or pipe that a particular file descriptor corresponds to.

The u flag simply means that the FD is read-write; w means write-only, r means read-only.

ish
  • 138,666
  • 36
  • 303
  • 312
  • 1
    Thanx a lot,i couldn't think like that because i could not relate dropbox and gnome-panel with each other.You simply explained. – myildirim Jul 03 '12 at 08:33
  • **This answer is not right**. These two FDs belong to different processes which have two different FD namespaces. – heemayl Oct 11 '16 at 03:06
2

File descriptors are defined in a per process namespace. They are not unique for the entire system. The two processes shown are not accessing the same file as evidenced by the DEVICE column which, in this case, likely shows the device name of your TCP socket.

onlyanegg
  • 121
  • 3