[OT] Hardlinks and directories

Patrick O'Callaghan pocallaghan at gmail.com
Fri Feb 12 17:08:32 UTC 2010


On Fri, 2010-02-12 at 07:04 -0800, Don Quixote de la Mancha wrote:
> Actually that is not quite true.  A seemingly bizarre and just about
> always surprising but well-documented and surprisingly useful
> requirement of UNIX filesystem symantics is that a file does not
> actually disappear until *two* things both occur:
> 
> 1. The last hard link disappears.
> 
> 2. The file is closed.

Yes indeed. I was trying to simplify. The real criterion is "does the
inode have any links to it?" where "links" includes open file
descriptors.

Which of course explains why Unix has no "remove file" system call, just
"unlink()". The fact that the system reclaims space which can no longer
be accessed is merely an efficiency detail :-)

poc



More information about the users mailing list