2

I have two quick questions:

When do two file descriptors point to the same open file ?

When do two open files point to the same inode ?

Also, if you happen to have some good documentation with graphs explaining this, i'll be very grateful if you show me the link to it :)

Thanks!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
amanda
  • 23
  • 3

1 Answers1

2

You can open as many file descriptors to a single file as you like - just call open() a few times. It's common for operating systems to allow a file either to be opened for reading (by as many clients as want access) or for reading and writing (but by only a single client).

Two files in a filesystem could point to the same inode if they were hard links to the same file.

crazyscot
  • 11,819
  • 2
  • 39
  • 40
  • 1
    You can open as many file descriptors as you like; as long as it's within the allowable limits of that process's maximum allowable number of open files. – joshua.thomas.bird Feb 27 '13 at 19:27