If I do:
fd2 = open ("file", O_RDONLY);
and then
fd1 = open ("file", O_RDONLY);
in the SAME PROCESS.
Do I get two different file pointers? I mean, can I move the “cursor” 100 bytes with fd2 and
fd1’s cursor will remain zero?
In addition, even if I open both for READONLY .. Does the filesystem creates TWO entries in the File table? or only one ? (Not the Inode table)
thanks!
Note: the initial version had a copy and paste bug which affects the result. Fixed now.
On a try it and see basis, I wrote
Which returns
on my Mac OS 10.5 box and something functionally identical on a Scientific Linux box (differs only in the size of
/etc/passwd).You’ll notice that you get back numerically different
fds, and they each their own position cursor.