3 ms·
> Random side note: on MacOS, the kernel does know all the filenames of a hardlink, because hardlinks are secretly implemented as fancy symlink-like data struct
by Karellen 4y ago
> Random side note: on MacOS, the kernel does know all the filenames of a hardlink, because hardlinks are secretly implemented as fancy symlink-like data structures. You normally don't see any symptoms of this except that hardlinks are suspiciously slow on MacOS. But in exchange for the slowness, the kernel actually can look up all filenames of a hardlink if it wants. I think this has something to do with Aliases and finding .app files even if they move around, or something.
This reads weird to me.
As the author points out, a directory entry (hardlink) is just a filename pointing to an inode. When you first create a file, and there is only one filename for that file, that entry is a hardlink. So in that text the first occurrence of "hardlink" should probably read "the kernel does know all the filenames of an inode".
But then it gets weird. When the author says "hardlinks are suspiciously slow on MacOS", it sounds like they're saying "accessing files is suspiciously slow on MacOS" - because accessing any file in the filesystem goes through hardlinks. All links to a file, including the first, are hardlinks.
- dezgeg 4y agoI suppose it's perfectly allowed for MacOS to simulate Unix hard link semantics (ie. names are just pointers to inodes, with each name being equal) even though the underlying filesystem doesn't have the name+inode split. It seems indeed this is the case on HFS+: https://developer.apple.com/library/archive/technotes/tn/tn1150.html#HardLinks https://developer.apple.com/library/archive/technotes/tn/tn1...
- Karellen 4y agoAh, that makes it much clearer, thanks.
- 95014_refugee 4y agoIt reads weird because it's a roughly equal mix of opinion and wrong, possibly informed by some historical understanding of how HFS+ used to work. Granted, in 2018 HFS+ was still kind of relevant, but even at that point the listed assertions were pretty dodgy.