Question about the kernel's global open file table
Hey guys!
I'm a little confused on how the global open file table works and how the kernel decides if a new entry should be added or if an existing one should just just have its f_count++'d
So here is a simple scenario:
Process1 opens a file using flags 123 and mode 456
Process2 also opens that file using flags 123 and mode 456
In this situation would the kernel have 2 file entries in the global open file table, or would it just +1 the f_count on one entry since the inode number, flags, and mode are the same?
If it does just +1 the reference does this mean the 2 processes have to share the file offset? I can't see how that would be good.
So yeah to recap my question is: How does the kernel decide between adding another file entry to the global open file table or just +1 the reference count of an existing one?
Thanks!