>>>> "Tom" == Tom Jennings
<tomj(a)wps.com> writes:
Tom> On Sun, 3 Oct 2004, Ron Hudson wrote:
> Ok, What do you mean... It seems to me your saying
that if I
> rename the file and name a new one in it's place the running
> process (simh) will continue to access the old file..(perhaps by
> inode)
Tom> The directory entry ("foo.x") simply points to the inode that is
Tom> the file. So once a process has a file opened, it references
Tom> the file via the inode, so renaming the file has no effect.
Tom> THe only "danger" is if the process needs to re-open the file
Tom> (after closing it) and you've renamed it, but that's obvious,
Tom> huh.
Tom> (This is a secure way to handle temporary files: a process opens
Tom> a file then deletes (unlinks) it, as long as the file is open,
Tom> it (the inode) continues to exist; it will disappear when all
Tom> references to the inode disappear, eg. you close the file. The
Tom> advantage is, since the file doesn't have a name (in the
Tom> directory) no other process can open it.)
FWIW, much of that is true for various other file systems -- probably
most of them. For example, RSTS, RSX, and VMS all work that way too.
RSTS doesn't have inodes, but it does have state that points to an
open file, and renaming or deleting doesn't disturb that. And they
all have temporary files "marked for delete" as described above.
paul