Reputation: 799
Dennis Ritchie and Ken Thompson's paper UNIX Time-Sharing System mentions the following points
Does this mean that the file descriptor is just the i-number of a file? Or am I missing something?
Upvotes: 1
Views: 306
Reputation: 6908
To add to Chris Dodd's answer, not only are inode numbers and file descriptor numbers not directly related, it wouldn't be practical for them to be.
Inode numbers are unique to each file system. Imagine if you opened fileA
on a file system (say, /mnt
) with inode number 100
, and in the same process also opened fileB
on another filesystem (say, /mnt2
) which also happened to have inode number 100
. What should the file descriptors be in that case?
Upvotes: 1
Reputation: 126203
A file descriptor in UNIX is basically just an index into the array of open files for the current process.
An inode number is an index into the inode table for the file system.
So they're basically just integers, indexes into an array, but they are indexes into completely different, unrelated arrays. So there is no connection between them.
Upvotes: 2