Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 3
    While multiple filenames can point to the same inode, the inode number of the file itself is still unique, so if you could point to the executable via the inode number, you would get that particular program. Sure, if the program looked at its argv[0] to decide what to do, you'd need to make sure to pass the correct name there. But that's the same as with command line arguments, and on the low level, argv[0] is one of them. It's not tied to the actual path of the file, but passed separately in execve(). Commented Nov 21, 2022 at 9:06
  • 4
    @ilkkachu: There is no guarantee that inode numbers are unique. They are only guaranteed to be unique per-filesystem. Commented Nov 21, 2022 at 10:18
  • 2
    yes, of course, any reference by inode would necessarily need to include the filesystem. Commented Nov 21, 2022 at 11:21
  • @ilkkachu: Indeed, and you identify that filesystem by its mount point, which is a ... path. So instead of a path, you now need a path plus an inode number. That's not making it better, that's making it worse. Commented Nov 22, 2022 at 13:29
  • 1
    @MSalters all mount points also have a device number. If you combine the device number with the inode number, then you do have a unique number kernel-wide that identifies a specific file with a caveat. I believe some of the non-UNIX network file systems can't guarantee a unique inode every time, but I believe all open file handles would operate with a unique one. Commented Nov 22, 2022 at 23:49